Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
6,700
def handle(self, app_name=None, target=None, **options): self.validate_name(app_name, "app") # Check that the app_name cannot be imported. try: import_module(app_name) except __HOLE__: pass else: raise CommandError("%r conflicts with the name ...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/management/commands/startapp.py/Command.handle
6,701
def _httpfilename(response): """ Python2/3 compatibility function. Returns the filename stored in the `Content-Disposition` HTTP header of given `response`, or `None` if that header is absent. """ try: # Py3 return response.info().get_filename() except __HOLE__: # Py2 impo...
AttributeError
dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/zoo/download.py/_httpfilename
6,702
def _getheader(response, header, default=None): """ Python2/3 compatibility function. Returns a HTTP `header` from given HTTP `response`, or `default` if that header is absent. """ try: # Py3 return response.getheader(header, default) except __HOLE__: # Py2 return response...
AttributeError
dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/zoo/download.py/_getheader
6,703
def parseXRDS(text): """Parse the given text as an XRDS document. @return: ElementTree containing an XRDS document @raises XRDSError: When there is a parse error or the document does not contain an XRDS. """ try: element = SafeElementTree.XML(text) except (SystemExit, MemoryErr...
ImportError
dataset/ETHPy150Open necaris/python3-openid/openid/yadis/etxrd.py/parseXRDS
6,704
def getCanonicalID(iname, xrd_tree): """Return the CanonicalID from this XRDS document. @param iname: the XRI being resolved. @type iname: unicode @param xrd_tree: The XRDS output from the resolver. @type xrd_tree: ElementTree @returns: The XRI CanonicalID or None. @returntype: unicode or...
IndexError
dataset/ETHPy150Open necaris/python3-openid/openid/yadis/etxrd.py/getCanonicalID
6,705
def getPriority(element): """Get the priority of this element Returns Max if no priority is specified or the priority value is invalid. """ try: return getPriorityStrict(element) except __HOLE__: return Max
ValueError
dataset/ETHPy150Open necaris/python3-openid/openid/yadis/etxrd.py/getPriority
6,706
def paginate(request, queryset_or_list, per_page=25, endless=True): if endless: paginator_class = EndlessPaginator else: paginator_class = BetterPaginator paginator = paginator_class(queryset_or_list, per_page) query_dict = request.GET.copy() if 'p' in query_dict: d...
TypeError
dataset/ETHPy150Open dcramer/django-paging/paging/helpers.py/paginate
6,707
def teardown(state): from django.conf import settings try: # Removing the temporary TEMP_DIR. Ensure we pass in unicode # so that it will successfully remove temp trees containing # non-ASCII filenames on Windows. (We're assuming the temp dir # name itself does not contain non-A...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/runtests.py/teardown
6,708
def bisect_tests(bisection_label, options, test_labels): state = setup(int(options.verbosity), test_labels) test_labels = test_labels or get_installed() print('***** Bisecting test suite: %s' % ' '.join(test_labels)) # Make sure the bisection point isn't in the test list # Also remove tests that ...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/runtests.py/bisect_tests
6,709
def paired_tests(paired_test, options, test_labels): state = setup(int(options.verbosity), test_labels) test_labels = test_labels or get_installed() print('***** Trying paired execution') # Make sure the constant member of the pair isn't in the test list # Also remove tests that need to be run in...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/runtests.py/paired_tests
6,710
def ImportPackage(packagepath, curs): """ Imports package data from the receipt at packagepath into our internal package database. """ bompath = os.path.join(packagepath, 'Contents/Archive.bom') infopath = os.path.join(packagepath, 'Contents/Info.plist') pkgname = os.path.basename(packagepa...
IndexError
dataset/ETHPy150Open munki/munki/code/client/munkilib/removepackages.py/ImportPackage
6,711
def ImportBom(bompath, curs): """ Imports package data into our internal package database using a combination of the bom file and data in Apple's package database into our internal package database. """ # If we completely trusted the accuracy of Apple's database, we wouldn't # need the bom f...
IndexError
dataset/ETHPy150Open munki/munki/code/client/munkilib/removepackages.py/ImportBom
6,712
def initDatabase(forcerebuild=False): """ Builds or rebuilds our internal package database. """ if not shouldRebuildDB(packagedb) and not forcerebuild: return True munkicommon.display_status_minor( 'Gathering information on installed packages') if os.path.exists(packagedb): ...
IOError
dataset/ETHPy150Open munki/munki/code/client/munkilib/removepackages.py/initDatabase
6,713
def removeFilesystemItems(removalpaths, forcedeletebundles): """ Attempts to remove all the paths in the array removalpaths """ # we sort in reverse because we can delete from the bottom up, # clearing a directory before we try to remove the directory itself removalpaths.sort(reverse=True) r...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/removepackages.py/removeFilesystemItems
6,714
def test_binary_operators(self): data1 = np.random.randn(20) data2 = np.random.randn(20) data1[::2] = np.nan data2[::3] = np.nan arr1 = SparseArray(data1) arr2 = SparseArray(data2) data1[::2] = 3 data2[::3] = 3 farr1 = SparseArray(data1, fill_val...
ValueError
dataset/ETHPy150Open pydata/pandas/pandas/sparse/tests/test_array.py/TestSparseArray.test_binary_operators
6,715
def validate(self, value): for t in self.types: try: return wtypes.validate_value(t, value) except (ValueError, __HOLE__): pass else: raise ValueError( _("Wrong type. Expected '%(type)s', got '%(value)s'") ...
TypeError
dataset/ETHPy150Open openstack/solum/solum/api/controllers/v1/datamodel/types.py/MultiType.validate
6,716
def save(self, force_insert=False, force_update=False, using=None): """ Calculate position (max+1) for new records """ if not self.position: max = self.__class__.objects.filter().aggregate(models.Max('position')) try: self.position = max['position_...
TypeError
dataset/ETHPy150Open baskoopmans/djcommon/djcommon/models.py/OrderableModel.save
6,717
def get_action_args(self, args): """Parse dictionary created by routes library.""" try: del args['controller'] except __HOLE__: pass try: del args['format'] except KeyError: pass return args
KeyError
dataset/ETHPy150Open openstack/ooi/ooi/wsgi/__init__.py/Resource.get_action_args
6,718
def __call__(self, request, args): """Control the method dispatch.""" action_args = self.get_action_args(args) action = action_args.pop('action', None) try: accept = request.get_best_match_content_type() content_type = request.get_content_type() except exc...
TypeError
dataset/ETHPy150Open openstack/ooi/ooi/wsgi/__init__.py/Resource.__call__
6,719
def get_serializer(self, content_type, default_serializers=None): """Returns the serializer for the wrapped object. Returns the serializer for the wrapped object subject to the indicated content type. If no serializer matching the content type is attached, an appropriate serializer dra...
TypeError
dataset/ETHPy150Open openstack/ooi/ooi/wsgi/__init__.py/ResponseObject.get_serializer
6,720
def authorize_same_account(account_to_match): def auth_callback_same_account(req): try: _ver, acc, _rest = req.split_path(2, 3, True) except __HOLE__: return HTTPUnauthorized(request=req) if acc == account_to_match: return None else: ...
ValueError
dataset/ETHPy150Open openstack/swift/swift/common/middleware/tempurl.py/authorize_same_account
6,721
def authorize_same_container(account_to_match, container_to_match): def auth_callback_same_container(req): try: _ver, acc, con, _rest = req.split_path(3, 4, True) except __HOLE__: return HTTPUnauthorized(request=req) if acc == account_to_match and con == container_t...
ValueError
dataset/ETHPy150Open openstack/swift/swift/common/middleware/tempurl.py/authorize_same_container
6,722
def _get_account_and_container(self, env): """ Returns just the account and container for the request, if it's an object request and one of the configured methods; otherwise, None is returned. :param env: The WSGI environment for the request. :returns: (Account str, cont...
ValueError
dataset/ETHPy150Open openstack/swift/swift/common/middleware/tempurl.py/TempURL._get_account_and_container
6,723
def _get_temp_url_info(self, env): """ Returns the provided temporary URL parameters (sig, expires), if given and syntactically valid. Either sig or expires could be None if not provided. If provided, expires is also converted to an int if possible or 0 if not, and checked for ...
ValueError
dataset/ETHPy150Open openstack/swift/swift/common/middleware/tempurl.py/TempURL._get_temp_url_info
6,724
@classmethod def deserialize(cls, data): message = openxc_pb2.VehicleMessage() try: message.ParseFromString(data) except google.protobuf.message.DecodeError as e: pass except __HOLE__ as e: LOG.warn("Unable to parse protobuf: %s", e) else: ...
UnicodeDecodeError
dataset/ETHPy150Open openxc/openxc-python/openxc/formats/binary.py/ProtobufFormatter.deserialize
6,725
@staticmethod def get_sync_data(): try: requestor_ids = os.listdir(cfg.CONF.pd_confs) except __HOLE__: return [] sync_data = [] requestors = (r.split(':') for r in requestor_ids if r.count(':') == 2) for router_id, subnet_id, ri_ifname in requestors: ...
OSError
dataset/ETHPy150Open openstack/neutron/neutron/agent/linux/dibbler.py/PDDibbler.get_sync_data
6,726
def run(self): """Run the rejected Application""" self.setup() self._mcp = self._master_control_program() try: self._mcp.run() except __HOLE__: LOGGER.info('Caught CTRL-C, shutting down') if self.is_running: self.stop()
KeyboardInterrupt
dataset/ETHPy150Open gmr/rejected/rejected/controller.py/Controller.run
6,727
def nextToken(self): # skip whitespace while not self.isEOF() and self.is_whitespace(): self.next_ch() if self.isEOF(): return Tok(type = EOF) # first, try to match token with 2 or more chars t = self.match_pattern() if t: retu...
KeyError
dataset/ETHPy150Open kennethreitz/tablib/tablib/packages/xlwt3/ExcelFormulaLexer.py/Lexer.nextToken
6,728
def prepare_subprocess(): # don't create core file try: setrlimit(RLIMIT_CORE, (0, 0)) except (__HOLE__, resource_error): pass
ValueError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_faulthandler.py/prepare_subprocess
6,729
def mkdir(path): """ mkdir(path) Creates the directory including parent directories """ try: os.makedirs(path) except __HOLE__: pass
OSError
dataset/ETHPy150Open facebook/IT-CPE/code/lib/modules/fs_tools.py/mkdir
6,730
def append(self, member, tarobj): header = '' for field in self.header_fields: value = getattr(member, field) if field == 'type': field = 'typeflag' elif field == 'name': if member.isdir() and not value.endswith('/'): ...
KeyError
dataset/ETHPy150Open docker/docker-registry/docker_registry/lib/checksums.py/TarSum.append
6,731
def fetchone(self): # PEP 249 self._wait_to_finish() if not self.has_result_set: raise ProgrammingError("Tried to fetch but no results.") log.debug('Fetching a single row') try: return next(self) except __HOLE__: return None
StopIteration
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/HiveServer2Cursor.fetchone
6,732
def fetchmany(self, size=None): # PEP 249 self._wait_to_finish() if not self.has_result_set: raise ProgrammingError("Tried to fetch but no results.") if size is None: size = self.arraysize log.debug('Fetching up to %s result rows', size) local_buff...
StopIteration
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/HiveServer2Cursor.fetchmany
6,733
def fetchall(self): # PEP 249 self._wait_to_finish() log.debug('Fetching all result rows') try: return list(self) except __HOLE__: return []
StopIteration
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/HiveServer2Cursor.fetchall
6,734
def connect(host, port, timeout=None, use_ssl=False, ca_cert=None, user=None, password=None, kerberos_service_name='impala', auth_mechanism=None): log.debug('Connecting to HiveServer2 %s:%s with %s authentication ' 'mechanism', host, port, auth_mechanism) sock = get_socket(h...
AttributeError
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/connect
6,735
def build_summary_table(summary, idx, is_fragment_root, indent_level, output): """Direct translation of Coordinator::PrintExecSummary() to recursively build a list of rows of summary statistics, one per exec node summary: the TExecSummary object that contains all the summary data idx: the index of the...
KeyError
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/build_summary_table
6,736
def _get(self, call, url=None, **kwargs): """ Sends an HTTP GET request to the specified URL, and returns the JSON object received (if any), or whatever answer it got otherwise. """ if not url: url = self.get_api_url() response = self.session.get(url + call, ...
ValueError
dataset/ETHPy150Open Doist/todoist-python/todoist/api.py/TodoistAPI._get
6,737
def _post(self, call, url=None, **kwargs): """ Sends an HTTP POST request to the specified URL, and returns the JSON object received (if any), or whatever answer it got otherwise. """ if not url: url = self.get_api_url() response = self.session.post(url + cal...
ValueError
dataset/ETHPy150Open Doist/todoist-python/todoist/api.py/TodoistAPI._post
6,738
def readchar(fd): """ Read a character from the PTY at `fd`, or nothing if no data to read. """ while True: ready = wait(fd) if len(ready) == 0: return six.binary_type() else: for s in ready: try: return os.read(s, 1) ...
OSError
dataset/ETHPy150Open d11wtq/dockerpty/tests/util.py/readchar
6,739
def proc_f32(filename): '''Load an f32 file that has already been processed by the official matlab file converter. That matlab data is saved to an m-file, which is then converted to a numpy '.npz' file. This numpy file is the file actually loaded. This function converts it to a neo block and returns ...
IOError
dataset/ETHPy150Open NeuralEnsemble/python-neo/neo/test/iotest/test_brainwaref32io.py/proc_f32
6,740
def grep(query): matcher = re.compile(re.escape(query)) t = time() - 1 result = [] for r in get_projects(): for name, path, root, top, fullpath in get_files(r): if time() - t >= 1: redraw() print fullpath t = time() try: ...
OSError
dataset/ETHPy150Open baverman/vial/vial/plugins/grep/plugin.py/grep
6,741
def __init__(self, ourParent, ourMsg, ourIcon=None, *args, **kwargs): Popup.__init__(self, ourParent, *args, **kwargs) self.callback_block_clicked_add(lambda obj: self.delete()) # Add a table to hold dialog image and text to Popup tb = Table(self, size_hint_weight=EXPAND_BOTH) s...
RuntimeError
dataset/ETHPy150Open JeffHoogland/python-elm-extensions/elmextensions/StandardPopup.py/StandardPopup.__init__
6,742
@contextlib.contextmanager def open_spinner(message): # Interactive spinner goes directly to sys.stdout rather than being routed # through the logging system, but it acts like it has level INFO, # i.e. it's only displayed if we're at level INFO or better. # Non-interactive spinner goes through the loggi...
KeyboardInterrupt
dataset/ETHPy150Open pypa/pip/pip/utils/ui.py/open_spinner
6,743
def loadScript(script_name): # call other script prefix, suffix = os.path.splitext(script_name) dirname = os.path.relpath(os.path.dirname(script_name)) basename = os.path.basename(script_name)[:-3] if os.path.exists(prefix + ".pyc"): try: os.remove(prefix + ".pyc") exc...
ImportError
dataset/ETHPy150Open CGATOxford/cgat/tests/test_commandline.py/loadScript
6,744
def test_cmdline(): '''test style of scripts ''' # start script in order to build the command line parser global ORIGINAL_START if ORIGINAL_START is None: ORIGINAL_START = E.Start # read the first two columns map_option2action = IOTools.readMap( IOTools.openFile(FILENAME_OPT...
SystemExit
dataset/ETHPy150Open CGATOxford/cgat/tests/test_commandline.py/test_cmdline
6,745
def _solve_1_slack_qp(self, constraints, n_samples): C = np.float(self.C) * n_samples # this is how libsvm/svmstruct do it joint_features = [c[0] for c in constraints] losses = [c[1] for c in constraints] joint_feature_matrix = np.vstack(joint_features) n_constraints = len(join...
ValueError
dataset/ETHPy150Open pystruct/pystruct/pystruct/learners/one_slack_ssvm.py/OneSlackSSVM._solve_1_slack_qp
6,746
def fit(self, X, Y, constraints=None, warm_start=False, initialize=True): """Learn parameters using cutting plane method. Parameters ---------- X : iterable Traing instances. Contains the structured input objects. No requirement on the particular form of entries ...
KeyboardInterrupt
dataset/ETHPy150Open pystruct/pystruct/pystruct/learners/one_slack_ssvm.py/OneSlackSSVM.fit
6,747
def get(self, key, default=None): try: return self.__getitem__(key) except __HOLE__: return default
KeyError
dataset/ETHPy150Open graphql-python/graphene/graphene/utils/proxy_snake_dict.py/ProxySnakeDict.get
6,748
def _activate(locale): # XXX TODO: When it comes time to load .mo files on the fly and merge # them, this is the place to do it. We'll also need to implement our own # caching since the _translations stuff is built on a per locale basis, # not per locale + some key locale = django_trans.to_locale(l...
IOError
dataset/ETHPy150Open clouserw/tower/tower/__init__.py/_activate
6,749
def build_path(repo, path, entries=None, root=None): """ Builds out a tree path, starting with the leaf node, and updating all trees up the parent chain, resulting in (potentially) a new OID for the root tree. If ``entries`` is provided, those entries are inserted (or updated) in the tree for t...
KeyError
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/build_path
6,750
def glob1(repo, tree, dirname, pattern): if not dirname: dirname = os.curdir if isinstance(pattern, unicode) and not isinstance(dirname, unicode): dirname = unicode(dirname, sys.getfilesystemencoding() or sys.getdefaultencoding()) if dirname != os.curdir: tr...
KeyError
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/glob1
6,751
def path_exists(tree, path): try: tree[path] except __HOLE__: return False return True
KeyError
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/path_exists
6,752
def format_int(val): try: # for python 2.7 and up return '{:,}'.format(val) except __HOLE__: # pragma nocover _format_int(val)
ValueError
dataset/ETHPy150Open lsbardel/python-stdnet/stdnet/utils/__init__.py/format_int
6,753
def process_response(self, request, response): try: if request.stop_editing and not request.continue_editing: request.session["editing"] = None except __HOLE__ as e: pass return response
AttributeError
dataset/ETHPy150Open lsaffre/lino/lino/utils/editing.py/EditingMiddleware.process_response
6,754
def __getattribute__(self, key): try: return object.__getattribute__(self, key) except __HOLE__: pass subject, buffer = [object.__getattribute__(self, x) for x in ('_subject', '_buffer')] try: ...
AttributeError
dataset/ETHPy150Open zzzeek/sqlalchemy/lib/sqlalchemy/testing/replay_fixture.py/ReplayableSession.Recorder.__getattribute__
6,755
def __getattribute__(self, key): try: return object.__getattribute__(self, key) except __HOLE__: pass buffer = object.__getattribute__(self, '_buffer') result = buffer.popleft() if result is ReplayableSession.Callable: ...
AttributeError
dataset/ETHPy150Open zzzeek/sqlalchemy/lib/sqlalchemy/testing/replay_fixture.py/ReplayableSession.Player.__getattribute__
6,756
def _toint(self, it): try: return int(it) except __HOLE__: return it
ValueError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStat._toint
6,757
def read(self, pid=None): if pid is not None: self.pid = int(pid) if self.pid is not None: try: self.stats = self._get_psinfo(pid) except __HOLE__: # no such process self.pid = None self.stats = None else: ...
IOError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStat.read
6,758
def get_stat(self, name): if not self.stats: raise ValueError, "no stats - run read(pid)" try: return self.stats[self._STATINDEX[name]] except __HOLE__: raise ValueError, "no attribute %s" % name
KeyError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStat.get_stat
6,759
def __getattr__(self, name): try: return self.get_stat(name) except __HOLE__, err: raise AttributeError, err
ValueError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStat.__getattr__
6,760
def __getitem__(self, name): try: return getattr(self, name) except __HOLE__, err: raise KeyError, err
AttributeError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStat.__getitem__
6,761
def read(self): rv = self._ptable = {} for pfile in os.listdir("/proc"): try: pid = int(pfile) # filter out non-numeric entries in /proc except __HOLE__: continue rv[pid] = ProcStat(pid)
ValueError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStatTable.read
6,762
def tree(self): class _pholder: pass self.read() if not self._ptable.has_key(0): p0 = self._ptable[0] = _pholder() p0.pid = p0.ppid = 0 p0.cmdline = "<kernel>" for p in self._ptable.values(): try: self._ptable[p...
AttributeError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/OS/SunOS/procfs.py/ProcStatTable.tree
6,763
def _unwind(self): if hasattr(self, '_forms'): return related_form = self.related_form if related_form is None: raise FormError('Related form not specified') prefix = '' if related_form.prefix: prefix = '%s_' % related_form.prefix prefi...
ValidationError
dataset/ETHPy150Open quantmind/lux/lux/forms/formsets.py/FormSet._unwind
6,764
def scrape(self, url): """Scrapes a url by passing it through youtube-dl""" if not is_youtube(url): return # FIXME: Sometimes youtube-dl takes a *long* time to run. This # needs to give indication of progress. try: output = subprocess.check_output( ...
OSError
dataset/ETHPy150Open pyvideo/steve/steve/scrapers.py/YoutubeScraper.scrape
6,765
@app.route('/cookies') def view_cookies(request, hide_env=True): """Returns cookie data.""" cookies = dict(request.cookies.items()) if hide_env and ('show_env' not in request.args): for key in ENV_COOKIES: try: del cookies[key] except __HOLE__: ...
KeyError
dataset/ETHPy150Open mozillazg/bustard/tests/httpbin/core.py/view_cookies
6,766
def find_template_source(name, dirs=None): # Calculate template_source_loaders the first time the function is executed # because putting this logic in the module-level namespace may cause # circular import errors. See Django ticket #1292. global template_source_loaders if template_source_loaders is ...
ImportError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/template/loader.py/find_template_source
6,767
def get_project_id(): """Retrieves Cloud Storage project id from user or file. Returns: The string project id. """ project_file = None project_id = None try: project_file = open(PROJECT_FILE, 'r') project_id = project_file.read() except __HOLE__: project_file = open(PROJECT_FILE, 'w') ...
IOError
dataset/ETHPy150Open googlearchive/storage-getting-started-python/main.py/get_project_id
6,768
def main(argv): """Main application control.""" try: argv = FLAGS(argv) except gflags.FlagsError, e: logging.error('%s\\nUsage: %s ARGS\\n%s', e, argv[0], FLAGS) sys.exit(1) # Set the logging according to the command-line flag numeric_level = getattr(logging, FLAGS.logging_level.upper()) if not...
ValueError
dataset/ETHPy150Open googlearchive/storage-getting-started-python/main.py/main
6,769
def server_forever(self): try: logger.debug("Start Listening on %s:%s ...." % (self.address, self.port)) self.server = self.create_server(self.address, self.port) self.server.start() tornado.ioloop.IOLoop.instance().start() except __HOLE__: tor...
KeyboardInterrupt
dataset/ETHPy150Open whiteclover/Fukei/fukei/server.py/FukeiSocksServer.server_forever
6,770
def __getattribute__(self, name): get = super(HandlerProxy, self).__getattribute__ try: return get(name) except AttributeError: pass handlers = get('_handlers') path = get('path') try: handler = getattr(handlers, path) except __...
AttributeError
dataset/ETHPy150Open charettes/django-mutant/mutant/state/utils.py/HandlerProxy.__getattribute__
6,771
def render(self, name, value, attrs=None): try: year_val, month_val, day_val = value.year, value.month, value.day except AttributeError: year_val = month_val = day_val = None if isinstance(value, six.string_types): if settings.USE_L10N: ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/forms/extras/widgets.py/SelectDateWidget.render
6,772
def value_from_datadict(self, data, files, name): y = data.get(self.year_field % name) m = data.get(self.month_field % name) d = data.get(self.day_field % name) if y == m == d == "0": return None if y and m and d: if settings.USE_L10N: inpu...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/forms/extras/widgets.py/SelectDateWidget.value_from_datadict
6,773
def _has_changed(self, initial, data): try: input_format = get_format('DATE_INPUT_FORMATS')[0] data = datetime_safe.datetime.strptime(data, input_format).date() except (TypeError, __HOLE__): pass return super(SelectDateWidget, self)._has_changed(initial, data)
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/forms/extras/widgets.py/SelectDateWidget._has_changed
6,774
def ready(self): """ Load modules returned by `get_load_modules_when_ready` by default when app is ready. """ super().ready() package = self.module.__name__ for module in self.get_load_modules_when_ready(): try: import_module('{}.{}'.fo...
ImportError
dataset/ETHPy150Open allegro/ralph/src/ralph/apps.py/RalphAppConfig.ready
6,775
def strip_tag(version): """ Strip trailing non-numeric components from a version leaving the Teradata 't' on the final version component if it's present. ['1', '2', 'THREE'] -> (1, 2) ['1', 'TWO', '3'] -> raises a ValueError ['0', '115t', 'SNAPSHOT'] -> (0, '115t') ['ZERO', '123t'] -> raises...
IndexError
dataset/ETHPy150Open prestodb/presto-admin/prestoadmin/util/version_util.py/strip_tag
6,776
def _read_swift_topology(): LOG.debug("Reading Swift nodes topology from {config}".format( config=CONF.swift_topology_file)) topology = {} try: with open(CONF.swift_topology_file) as f: for line in f: line = line.strip() if not line: ...
IOError
dataset/ETHPy150Open openstack/sahara/sahara/topology/topology_helper.py/_read_swift_topology
6,777
def _read_compute_topology(): LOG.debug("Reading compute nodes topology from {config}".format( config=CONF.compute_topology_file)) ctx = context.ctx() tenant_id = str(ctx.tenant_id) topology = {} try: with open(CONF.compute_topology_file) as f: for line in f: ...
IOError
dataset/ETHPy150Open openstack/sahara/sahara/topology/topology_helper.py/_read_compute_topology
6,778
def __init__(self, fd, hostname=None, port=None, use_ssl=False): """Create a request. fd should be either a socket descriptor or a string. In both case, it should contain a full request. To generate a request from a URL, see c()""" if isinstance(fd, basestring): fd = StringIO(fd) try: ...
ValueError
dataset/ETHPy150Open tweksteen/burst/burst/http.py/Request.__init__
6,779
def __init__(self, fd, request, chunk_func=None): if isinstance(fd, basestring): fd = StringIO(fd) try: banner = read_banner(fd) # ASSUMPTION: A response status line contains at least two elements # seperated by a space self.http_version, self.status = banner[:2] ...
ValueError
dataset/ETHPy150Open tweksteen/burst/burst/http.py/Response.__init__
6,780
@property def content_type(self): try: return self.get_header("Content-Type")[0] except __HOLE__: return None
IndexError
dataset/ETHPy150Open tweksteen/burst/burst/http.py/Response.content_type
6,781
def parallel(self, threads=4, verbose=True, **kw): stop = threading.Event() indices = range(len(self.reqs)) jobs = [] for ics in chunks(indices, threads): mkw = kw.copy() mkw.update({"indices":ics, "stop_event":stop, "verbose":False}) t = threading.Thread(target=self.__call__, kwargs=m...
KeyboardInterrupt
dataset/ETHPy150Open tweksteen/burst/burst/http.py/RequestSet.parallel
6,782
def _http_connect(hostname, port, use_ssl): p_url = urlparse.urlparse(conf.proxy) p_hostname = p_url.hostname p_port = p_url.port p_use_ssl = True if p_url.scheme[-1] == 's' else False try: sock = socket.create_connection((p_hostname, p_port)) except socket.error: raise ProxyError("Unable to connect...
ValueError
dataset/ETHPy150Open tweksteen/burst/burst/http.py/_http_connect
6,783
def buildAttributes(self, node, attrs, already_processed): value = find_attr_value_('sightings_count', node) if value is not None and 'sightings_count' not in already_processed: already_processed.add('sightings_count') try: self.sightings_count = int(value) ...
ValueError
dataset/ETHPy150Open STIXProject/python-stix/stix/bindings/indicator.py/SightingsType.buildAttributes
6,784
def buildAttributes(self, node, attrs, already_processed): value = find_attr_value_('timestamp', node) if value is not None and 'timestamp' not in already_processed: already_processed.add('timestamp') try: self.timestamp = self.gds_parse_datetime(value, node, 'tim...
ValueError
dataset/ETHPy150Open STIXProject/python-stix/stix/bindings/indicator.py/SightingType.buildAttributes
6,785
def motion(self, *args): tvColId = self.treeView.identify_column(args[0].x) tvRowId = self.treeView.identify_row(args[0].y) if tvColId != self.toolTipColId or tvRowId != self.toolTipRowId: self.toolTipColId = tvColId self.toolTipRowId = tvRowId newValue = self...
ValueError
dataset/ETHPy150Open Arelle/Arelle/arelle/ViewWinTree.py/ViewTree.motion
6,786
def contextMenu(self): try: return self.menu except __HOLE__: try: self.menu = Menu( self.viewFrame, tearoff = 0 ) self.treeView.bind( self.modelXbrl.modelManager.cntlr.contextMenuClick, self.popUpMenu, '+' ) return self.menu ...
AttributeError
dataset/ETHPy150Open Arelle/Arelle/arelle/ViewWinTree.py/ViewTree.contextMenu
6,787
def render_GET(self, request): msg = base64.urlsafe_b64decode(request.args["t"][0]) tmppub, boxed0 = decrypt_list_request_1(msg) if tmppub in self.old_requests: request.setResponseCode(http.BAD_REQUEST, "Replay") return "Replay" ts, RT = decrypt_list_request_2(tmp...
KeyError
dataset/ETHPy150Open warner/petmail/petmail/mailbox/server.py/RetrievalListResource.render_GET
6,788
def shutdown(sups): global SHOULD_STOP SHOULD_STOP = True LOG.warn("Supervisor shutting down!") for pid in CHILD_PIDS: try: os.kill(pid, signal.SIGINT) except __HOLE__: pass LOG.warn("Waiting for children to exit for %d seconds..." % WAIT_FOR_DEATH) t = time.time() still_alive = Fal...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/supervisor.py/shutdown
6,789
def drop_privileges(): """Drop root privileges down to the specified SETUID_USER. N.B. DO NOT USE THE logging MODULE FROM WITHIN THIS FUNCTION. This function is run in forked processes right before it calls exec, but the fork may have occured while a different thread had locked the log. Since it's a forked p...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/supervisor.py/drop_privileges
6,790
def load_known_hosts(self, filename=None): """Load host keys from an openssh :file:`known_hosts`-style file. Can be called multiple times. If *filename* is not specified, looks in the default locations i.e. :file:`~/.ssh/known_hosts` and :file:`~/ssh/known_hosts` for Windows. """ if fil...
IOError
dataset/ETHPy150Open osrg/ryu/ryu/contrib/ncclient/transport/ssh.py/SSHSession.load_known_hosts
6,791
def imitate_pydoc(string): """ It's not possible to get the pydoc's without starting the annoying pager stuff. """ # str needed because of possible unicode stuff in py2k (pydoc doesn't work # with unicode strings) string = str(string) h = pydoc.help with common.ignored(KeyError): ...
KeyError
dataset/ETHPy150Open JulianEberius/SublimePythonIDE/server/lib/python_all/jedi/api/keywords.py/imitate_pydoc
6,792
def __new__(cls, name, bases, attrs): try: parents = [b for b in bases if issubclass(b, DocumentForm)] except __HOLE__: # We are defining ModelForm itself. parents = None declared_fields = get_declared_fields(bases, attrs, False) new_class...
NameError
dataset/ETHPy150Open benoitc/couchdbkit/couchdbkit/ext/django/forms.py/DocumentFormMetaClass.__new__
6,793
def __delitem__(self, name): field_name = self._convert_name(name) try: del self._fields[field_name] except __HOLE__: raise KeyError(name)
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/distlib/metadata.py/LegacyMetadata.__delitem__
6,794
def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._legacy = None self._data = None self.scheme = scheme #import pdb...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/distlib/metadata.py/Metadata.__init__
6,795
def is_subclass(o, bases): """ Similar to the ``issubclass`` builtin, but does not raise a ``TypeError`` if either ``o`` or ``bases`` is not an instance of ``type``. Example:: >>> is_subclass(IOError, Exception) True >>> is_subclass(Exception, None) False >>> is...
TypeError
dataset/ETHPy150Open shazow/unstdlib.py/unstdlib/standard/type_.py/is_subclass
6,796
def do_execute(self, code, silent, store_history=True, user_expressions=None, allow_stdin=False): code = code.strip() reply = { 'status': 'ok', 'user_expressions': {}, } if code == 'start': child = Popen(['bash', '-i', '-c', 'sleep 3...
KeyboardInterrupt
dataset/ETHPy150Open jupyter/jupyter_client/jupyter_client/tests/signalkernel.py/SignalTestKernel.do_execute
6,797
def update(self, key, isselected): logger.debug("Begin generating plots") if not isselected: try: self.colorList.append(self._seriesInfos[key].color) del self._seriesInfos[key] except __HOLE__: self.resetDates() else: ...
KeyError
dataset/ETHPy150Open ODM2/ODMToolsPython/odmtools/controller/logicPlotOptions.py/SeriesPlotInfo.update
6,798
def test_errors(self): self.top.vehicle.ratio1 = 3.54 self.top.vehicle.ratio2 = 3.54 self.top.vehicle.ratio3 = 3.54 self.top.vehicle.ratio4 = 3.54 self.top.vehicle.ratio5 = 3.54 try: self.top.run() #sim_EPA_city.run() except __HOLE__, err: ...
RuntimeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/contrib/enginedesign/openmdao.examples.enginedesign/openmdao/examples/enginedesign/test/test_driving_sim.py/VehicleTestCase.test_errors
6,799
def prepare_prompt_env_variables(self, raw_prompt=None, module_prompt=None): if raw_prompt: os.environ["RSF_RAW_PROMPT"] = raw_prompt else: try: os.environ["RSF_RAW_PROMPT"] except __HOLE__: pass if module_prompt: o...
KeyError
dataset/ETHPy150Open reverse-shell/routersploit/routersploit/test/test_interpreter.py/RoutersploitInterpreterTest.prepare_prompt_env_variables