Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
8,300
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.net.proto2.proto import descriptor_pb2 try: options_class = getattr(descriptor_pb2...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/net/proto2/python/public/descriptor.py/DescriptorBase.GetOptions
8,301
@staticmethod def ProtoTypeToCppProtoType(proto_type): """Converts from a Python proto type to a C++ Proto Type. The Python ProtocolBuffer classes specify both the 'Python' datatype and the 'C++' datatype - and they're not the same. This helper method should translate from one to another. Args: ...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/net/proto2/python/public/descriptor.py/FieldDescriptor.ProtoTypeToCppProtoType
8,302
def analogRead(adc_pin): """ Returns voltage read on given analog input pin. If passed one of PyBBIO's AIN0-AIN5 keywords the voltage will be returned in millivolts. May also be passed the path to an AIN file as created by a cape overlay, in which case the value will be returned as found in the fil...
IOError
dataset/ETHPy150Open graycatlabs/PyBBIO/bbio/platform/beaglebone/adc.py/analogRead
8,303
@classmethod def download_file(cls, uri, fobj): """ Given a URI, download the file to the ``fobj`` file-like object. :param str uri: The URI of a file to download. :param file fobj: A file-like object to download the file to. :rtype: file :returns: A file handle to t...
AttributeError
dataset/ETHPy150Open duointeractive/media-nommer/media_nommer/core/storage_backends/s3.py/S3Backend.download_file
8,304
def getName(self): try: return self.params['name'] except __HOLE__: try: return self.params['object'] except KeyError: pass return None
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getName
8,305
def getPluralName(self): try: return self.params['pluralName'] except __HOLE__: pass return "%ss" % Field.getName(self)
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getPluralName
8,306
def getMapping(self): try: return self.params['mapping'] except __HOLE__: pass return 'one-to-one'
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getMapping
8,307
def getType(self): try: return self.params['type'] except __HOLE__: pass return 'str'
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getType
8,308
def getIndices(self): try: str = self.params['index'] indices = str.split() for i, index in enumerate(indices): compound_idx = index.split(':') if len(compound_idx) > 1: indices[i] = compound_idx return indices ...
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getIndices
8,309
def isInverse(self): try: return self.params['inverse'] == 'true' except __HOLE__: pass return False
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.isInverse
8,310
def getDiscriminator(self): try: return self.params['discriminator'] except __HOLE__: pass return None
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Field.getDiscriminator
8,311
def getReference(self): try: return self.params['object'] except __HOLE__: pass return ''
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Property.getReference
8,312
def isReference(self): try: return self.params['ref'] == 'true' except __HOLE__: pass return False
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Property.isReference
8,313
def isPrimaryKey(self): try: return self.params['primaryKey'] == 'true' except __HOLE__: pass return False
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Property.isPrimaryKey
8,314
def isForeignKey(self): try: return self.params['foreignKey'] == 'true' except __HOLE__: pass return False
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Property.isForeignKey
8,315
def getName(self): try: return self.params['name'] except __HOLE__: pass return None
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Object.getName
8,316
def getClassName(self): try: return self.params['className'] except __HOLE__: pass return 'DB%s' % capitalizeOne(Object.getName(self))
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Object.getClassName
8,317
def getDiscriminatorProperty(self, dName): try: for property in self.properties: if property.getName() == dName: return property except __HOLE__: pass return None
KeyError
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/bin/auto_gen_objects.py/Object.getDiscriminatorProperty
8,318
def TerminalSize(): """Returns terminal length and width as a tuple.""" try: with open(os.ctermid(), 'r') as tty: length_width = struct.unpack( 'hh', fcntl.ioctl(tty.fileno(), termios.TIOCGWINSZ, '1234')) except (IOError, OSError): try: length_width = (int(os.environ['LINES']), ...
ValueError
dataset/ETHPy150Open google/textfsm/terminal.py/TerminalSize
8,319
def __init__(self, text=None, delay=None): """Constructor. Args: text: A string, the text that will be paged through. delay: A boolean, if True will cause a slight delay between line printing for more obvious scrolling. """ self._text = text or '' self._delay = delay try: ...
IOError
dataset/ETHPy150Open google/textfsm/terminal.py/Pager.__init__
8,320
def run_config(cfstring, param): if not cfstring: print("No command string defined to run {0}.".format(param), file=sys.stderr) return try: cmd = cfstring % param except __HOLE__: # no %s in cfstring, so just stick the param on the end cmd = "%s %s" % (cfstring, param) pr...
TypeError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/devhelpers.py/run_config
8,321
def find_source_file(modname, path=None): if "." in modname: pkgname, modname = modname.rsplit(".", 1) pkg = find_package(pkgname) return find_source_file(modname, pkg.__path__) try: fo, fpath, (suffix, mode, mtype) = imp.find_module(modname, path) except __HOLE__: ex...
ImportError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/devhelpers.py/find_source_file
8,322
def find_package(packagename, searchpath=None): try: return sys.modules[packagename] except KeyError: pass for pkgname in _iter_subpath(packagename): if "." in pkgname: basepkg, subpkg = pkgname.rsplit(".", 1) pkg = sys.modules[basepkg] _load_packa...
KeyError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/devhelpers.py/find_package
8,323
def find_from_package(pkgname, modname): pkg = find_package(pkgname) try: fo, fpath, (suffix, mode, mtype) = imp.find_module(modname, pkg.__path__) except __HOLE__: ex, val, tb = sys.exc_info() print("{} => {}: {}!".format(modname, ex.__name__, val), file=sys.stderr) return N...
ImportError
dataset/ETHPy150Open kdart/pycopia/core/pycopia/devhelpers.py/find_from_package
8,324
def run(self, **options): """Override runserver's entry point to bring Gunicorn on. A large portion of code in this method is copied from `django.core.management.commands.runserver`. """ shutdown_message = options.get('shutdown_message', '') self.stdout.write("Performin...
KeyboardInterrupt
dataset/ETHPy150Open uranusjr/django-gunicorn/djgunicorn/management/commands/gunserver.py/Command.run
8,325
def listen(self): '''This method is the main loop that listens for requests.''' seeklock = threading.Lock() cowfiles = [] while True: try: conn, addr = self.sock.accept() # split off on a thread, allows us to handle multiple clients ...
KeyboardInterrupt
dataset/ETHPy150Open psychomario/PyPXE/pypxe/nbd/nbd.py/NBD.listen
8,326
def binomial(random_state, size=None, n=1, p=0.5, ndim=None, dtype='int64', prob=None): """ Sample n times with probability of success prob for each trial, return the number of successes. If the size argument is ambiguous on the number of dimensions, ndim may be a plain integer to supp...
TypeError
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/raw_random.py/binomial
8,327
def process_cmd_line(app, opts, args): """ Processes the passed command line arguments. Input Arguments: app -- A Mayavi application instance. opts -- The list of options returned by getopt. args -- The remaining arguments returned by getopt. """ from mayavi.core.common import erro...
ImportError
dataset/ETHPy150Open enthought/mayavi/mayavi/scripts/mayavi2.py/process_cmd_line
8,328
def isContainedInAll(contig, start, end, bedfiles): for bedfile in bedfiles: try: if len(list(bedfile.fetch(contig, start, end))) == 0: return False except KeyError: return False except __HOLE__: return False return True
ValueError
dataset/ETHPy150Open CGATOxford/cgat/scripts/beds2beds.py/isContainedInAll
8,329
def isContainedInOne(contig, start, end, bedfiles): for bedfile in bedfiles: try: if len(list(bedfile.fetch(contig, start, end))) > 0: return True except __HOLE__: pass except ValueError: pass return False
KeyError
dataset/ETHPy150Open CGATOxford/cgat/scripts/beds2beds.py/isContainedInOne
8,330
def _get_raw_data(self, image, format, quality): """ Returns the raw data from the Image, which can be directly written to a something, be it a file-like object or a database. :param PIL.Image image: The image to get the raw data for. :param str format: The format to save to. If...
IOError
dataset/ETHPy150Open gtaylor/django-athumb/athumb/pial/engines/pil_engine.py/PILEngine._get_raw_data
8,331
@classmethod def app(cls, slug, asset): game = get_game_by_slug(slug) if not game: abort(404, 'Invalid game: %s' % slug) try: depth = int(request.params.get('depth', cls.default_depth)) list_cull = int(request.params.get('list_cull', cls.default_list_cull...
TypeError
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/controllers/disassembler.py/DisassemblerController.app
8,332
def _submit_jobs(self, func, iterable, mode, chunksize=1, dependencies=[]): if mode not in ['map', 'reduce']: raise ValueError('mode must be one of "map" or "reduce"') moreData = True allJobs = [] iterable = iter(iterable) # for each partition while moreData: ...
TypeError
dataset/ETHPy150Open uci-cbcl/tree-hmm/treehmm/sge.py/SGEPool._submit_jobs
8,333
def run_safe_jobs( directory, jobs, processes=None): """In the event that Grid Engine is not installed, this program will run jobs serially on the local host.""" #pool = Pool(processes=max(cpu_count(), 1)) pool = Pool(processes=processes) errorCodes = [] for job in jobs: job.out = os.pat...
AssertionError
dataset/ETHPy150Open uci-cbcl/tree-hmm/treehmm/sge.py/run_safe_jobs
8,334
def main(): ''' map() a function against data as given in an input pickle file, saving result to a pickle.''' import sys, os, optparse usage = "%prog [options] inputPickle outputPickle \n" + main.__doc__ parser = optparse.OptionParser(usage) parser.add_option('--mode', dest='mode', type='string', ...
AttributeError
dataset/ETHPy150Open uci-cbcl/tree-hmm/treehmm/sge.py/main
8,335
def get_site_url(): try: from_site_config = m.config.Config.get('site', 'site_domain', None) from_settings = get_setting_value('SERVER_NAME', None) if from_settings and not from_settings.startswith('http'): from_settings = 'http://%s/' % from_settings return from_site_con...
RuntimeError
dataset/ETHPy150Open rochacbruno/quokka/quokka/utils/settings.py/get_site_url
8,336
def get_setting_value(key, default=None): try: return current_app.config.get(key, default) except __HOLE__ as e: logger.warning('current_app is inaccessible: %s' % e) try: app = create_app_min() db.init_app(app) with app.app_context(): return app.config.g...
RuntimeError
dataset/ETHPy150Open rochacbruno/quokka/quokka/utils/settings.py/get_setting_value
8,337
def _parse_options(options): """Returns a Response after validating the input. """ if options[1] in SORT_TYPES.keys(): sort_type = options[1] if len(options) > 2: subreddit, sort_type, num_results = options try: num_results = int(num_results) ...
ValueError
dataset/ETHPy150Open arjunblj/slack-reddit/app.py/_parse_options
8,338
def check_monospace(familydir): files = listdir(familydir) glyphwidths = [] for f in files: if not unicode(f).endswith('.ttf'): continue font = fontToolsOpenFont(unicode(f)) for table in font['cmap'].tables: if not (table.platformID == 3 and table.platEncID in...
IndexError
dataset/ETHPy150Open googlefonts/fontbakery/bakery_cli/scripts/genmetadata.py/check_monospace
8,339
def _load_storage(self): """Loads the storage backend. This will attempt to load the SSH storage backend. If there is an error in loading the backend, it will be logged, and an ImproperlyConfigured exception will be raised. """ try: path = getattr(settings, '...
ImportError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/ssh/client.py/SSHClient._load_storage
8,340
def get_user_key(self): """Returns the keypair of the user running Review Board. This will be an instance of :py:mod:`paramiko.PKey`, representing a DSS or RSA key, as long as one exists. Otherwise, it may return None. """ key = None fp = None try: k...
IOError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/ssh/client.py/SSHClient.get_user_key
8,341
def is_key_authorized(self, key): """Returns whether or not a public key is currently authorized.""" public_key = key.get_base64() try: lines = self.storage.read_authorized_keys() for line in lines: try: authorized_key = line.split()[...
IndexError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/ssh/client.py/SSHClient.is_key_authorized
8,342
def _write_user_key(self, key): """Convenience function to write a user key and check for errors. Any errors caused as a result of writing a user key will be logged. """ try: self.storage.write_user_key(key) except UnsupportedSSHKeyError as e: logging.err...
IOError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/ssh/client.py/SSHClient._write_user_key
8,343
def _ipython_active(): """return true if in an active IPython session""" try: import IPython except ImportError: return False try: if IPython.__version__ >= "0.12": return __IPYTHON__ return __IPYTHON__active except __HOLE__: return False
NameError
dataset/ETHPy150Open manahl/mdf/mdf/viewer/__init__.py/_ipython_active
8,344
def get_value(process, name): result = getattr(process, name) try: return result() except __HOLE__: return result
TypeError
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/processresources/processresources.py/get_value
8,345
def test_flake8(): """Test source code for pyFlakes and PEP8 conformance""" flake8style = flake8.engine.StyleGuide(max_line_length=120) report = flake8style.options.report report.start() this_dir = os.path.dirname(os.path.abspath(__file__)) try: input_dir = flake8style.input_dir exce...
AttributeError
dataset/ETHPy150Open catkin/catkin_tools/tests/test_code_format.py/test_flake8
8,346
def load(self): self._data = {} try: self._data = json.load(open(self.path, "rU")) self._dirty = False except __HOLE__: logger.warning("Unable to load configuration at '{0}'. No file found.".format(self.path)) except ValueError as e: logge...
IOError
dataset/ETHPy150Open koenbok/Cactus/cactus/config/file.py/ConfigFile.load
8,347
def add(self, review, reason): reason = 'amo:review:spam:%s' % reason try: reasonset = cache.get('amo:review:spam:reasons', set()) except __HOLE__: reasonset = set() try: idset = cache.get(reason, set()) except KeyError: idset = set...
KeyError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/reviews/models.py/Spam.add
8,348
def __new__(cls, *args, **kwargs): args, kwargs = cls._process_args(*args, **kwargs) # First argument is the object we're going to cache on cache_obj = args[0] # These are now the arguments to the subclass constructor args = args[1:] key = cls._cache_key(*args, **kwargs) ...
KeyError
dataset/ETHPy150Open OP2/PyOP2/pyop2/caching.py/ObjectCached.__new__
8,349
def __new__(cls, *args, **kwargs): args, kwargs = cls._process_args(*args, **kwargs) key = cls._cache_key(*args, **kwargs) def make_obj(): obj = super(Cached, cls).__new__(cls) obj._key = key obj._initialized = False # obj.__init__ will be called ...
IOError
dataset/ETHPy150Open OP2/PyOP2/pyop2/caching.py/Cached.__new__
8,350
def __init__(self, verbose_name=None, bases=(models.Model,), user_related_name='+', table_name=None, inherit=False): self.user_set_verbose_name = verbose_name self.user_related_name = user_related_name self.table_name = table_name self.inherit = inherit try: ...
TypeError
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.__init__
8,351
def finalize(self, sender, **kwargs): try: hint_class = self.cls except __HOLE__: # called via `register` pass else: if hint_class is not sender: # set in concrete if not (self.inherit and issubclass(sender, hint_class)): # set in abstract ...
AttributeError
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.finalize
8,352
def create_history_model(self, model): """ Creates a historical model to associate with the model provided. """ attrs = {'__module__': self.module} app_module = '%s.models' % model._meta.app_label if model.__module__ != self.module: # registered under differe...
NameError
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.create_history_model
8,353
def copy_fields(self, model): """ Creates copies of the model's original fields, returning a dictionary mapping field name to copied field object. """ fields = {} for field in model._meta.fields: field = copy.copy(field) try: field....
AttributeError
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.copy_fields
8,354
def get_history_user(self, instance): """Get the modifying user from instance or middleware.""" try: return instance._history_user except AttributeError: try: if self.thread.request.user.is_authenticated(): return self.thread.request.us...
AttributeError
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.get_history_user
8,355
def get_wordlist(language, word_source): """ Takes in a language and a word source and returns a matching wordlist, if it exists. Valid languages: ['english'] Valid word sources: ['bip39', 'wiktionary', 'google'] """ try: wordlist_string = eval(language + '_words_' + word_sou...
NameError
dataset/ETHPy150Open blockstack/pybitcoin/pybitcoin/passphrases/passphrase.py/get_wordlist
8,356
@classmethod def setupClass(cls): global plt try: import matplotlib as mpl mpl.use('PS',warn=False) import matplotlib.pyplot as plt except __HOLE__: raise SkipTest('matplotlib not available.') except RuntimeError: raise Skip...
ImportError
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/drawing/tests/test_pylab.py/TestPylab.setupClass
8,357
def load_item(item): with open(os.path.join(ITEM_DIR, item),'r') as e: try: logging.debug('Caching item: %s' % item) return json.loads(''.join(e.readlines())) except __HOLE__,e: raise Exception('Failed to load item: %s' % e)
ValueError
dataset/ETHPy150Open flags/Reactor-3/items.py/load_item
8,358
def read_file(filename, mode="rb"): """Returns the given file's contents. :param str filename: path to file :param str mode: open mode (see `open`) :returns: absolute path of filename and its contents :rtype: tuple :raises argparse.ArgumentTypeError: File does not exist or is not readable. ...
IOError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/cli.py/read_file
8,359
def prescan_for_flag(self, flag, possible_arguments): """Checks cli input for flags. Check for a flag, which accepts a fixed set of possible arguments, in the command line; we will use this information to configure argparse's help correctly. Return the flag's argument, if it has one th...
IndexError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/cli.py/HelpfulArgumentParser.prescan_for_flag
8,360
def layouts_info(): ''' Return list of informations about each available layout. Informations (title, slug, and preview) about each layout are laoded from the `MANIFEST.json` file in layout dir (if it exists), else default informations are returned. ''' layouts_list = [] # Get all availa...
ValueError
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/loaders/manifest.py/layouts_info
8,361
def themes_info(slug=None): ''' Loads the MANIFEST for each available theme >>> themes_info() {u'natim': {'preview': '/_static/themes/icon-themes.png', 'title': u'natim'}, u'jungleland': {'website': u'http://www.styleshout.com/', 'description': u'...', 'title': u'Jungle Land', 'a...
IOError
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/loaders/manifest.py/themes_info
8,362
def get_stats(self, params): metrics = {'status': {}} if not self.connect(params): return metrics rows = self.get_db_global_status() for row in rows: try: metrics['status'][row['Variable_name']] = float(row['Value']) except: ...
IndexError
dataset/ETHPy150Open Yelp/fullerite/src/diamond/collectors/mysqlstat/mysqlstat.py/MySQLCollector.get_stats
8,363
def collect(self): if MySQLdb is None: self.log.error('Unable to import MySQLdb') return False for host in self.config['hosts']: matches = re.search( '^([^:]*):([^@]*)@([^:]*):?([^/]*)/([^/]*)/?(.*)', host) if not matches: ...
ValueError
dataset/ETHPy150Open Yelp/fullerite/src/diamond/collectors/mysqlstat/mysqlstat.py/MySQLCollector.collect
8,364
def _safe_cls_name(cls): try: cls_name = '.'.join((cls.__module__, cls.__name__)) except __HOLE__: cls_name = getattr(cls, '__name__', None) if cls_name is None: cls_name = repr(cls) return cls_name
AttributeError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/orm/exc.py/_safe_cls_name
8,365
@util.dependencies("sqlalchemy.orm.base") def _default_unmapped(base, cls): try: mappers = base.manager_of_class(cls).mappers except NO_STATE: mappers = {} except __HOLE__: mappers = {} name = _safe_cls_name(cls) if not mappers: return "Class '%s' is not mapped" % na...
TypeError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/orm/exc.py/_default_unmapped
8,366
def ipython(self): """Start any version of IPython""" for ip in (self._ipython, self._ipython_pre_100, self._ipython_pre_011): try: ip() except __HOLE__: pass else: return # no IPython, raise ImportError ...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/management/commands/shell.py/Command.ipython
8,367
def run_shell(self, shell=None): available_shells = [shell] if shell else self.shells for shell in available_shells: try: return getattr(self, shell)() except __HOLE__: pass raise ImportError
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/management/commands/shell.py/Command.run_shell
8,368
def handle_noargs(self, **options): # XXX: (Temporary) workaround for ticket #1796: force early loading of all # models from installed apps. from django.db.models.loading import get_models get_models() use_plain = options.get('plain', False) no_startup = options.get('no_...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/management/commands/shell.py/Command.handle_noargs
8,369
def isnan(value): try: from math import isnan return isnan(value) except __HOLE__: return isinstance(value, float) and value != value
ImportError
dataset/ETHPy150Open Miserlou/django-easy-split/easy_split/stats.py/isnan
8,370
def unpack(self, buf): dpkt.Packet.unpack(self, buf) self.auth = self.data[:self.len] buf = self.data[self.len:] import ip try: self.data = ip.IP.get_proto(self.nxt)(buf) setattr(self, self.data.__class__.__name__.lower(), self.data) except (__HOLE...
KeyError
dataset/ETHPy150Open dragondjf/QMarkdowner/dpkt/ah.py/AH.unpack
8,371
@bp.route('/<int:project_id>/builds/<id>/') def build(project_id, id): project = get_project(project_id, for_management=False) if id == 'latest': build = project.get_latest_build(ref=request.args.get('ref')) if not build: return redirect(url_for('.settings', id=project_id)) else...
ValueError
dataset/ETHPy150Open aromanovich/kozmic-ci/kozmic/projects/views.py/build
8,372
def load(branchname): data = json.load(open(os.path.expanduser(config.SAVE_FILE))) repo_name = get_repo_name() try: return data['%s:%s' % (repo_name, branchname)] except __HOLE__: # possibly one of the old ones return data[branchname]
KeyError
dataset/ETHPy150Open peterbe/bgg/bgg/lib/makediff.py/load
8,373
def pub_ListResources (self, credentials, options): """Return information about available resources or resources allocated to a slice List the resources at this aggregate in an RSpec: may be all resources, only those available for reservation, or only those already reserved for the given slice. """ ...
AttributeError
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foam/api/gapi2.py/AMAPIv2.pub_ListResources
8,374
def addReader(self, reader): """ Implement L{IReactorFDSet.addReader}. """ fd = reader.fileno() if fd not in self._reads: try: self._updateRegistration(fd, KQ_FILTER_READ, KQ_EV_ADD) except __HOLE__: pass finally...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.addReader
8,375
def addWriter(self, writer): """ Implement L{IReactorFDSet.addWriter}. """ fd = writer.fileno() if fd not in self._writes: try: self._updateRegistration(fd, KQ_FILTER_WRITE, KQ_EV_ADD) except __HOLE__: pass final...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.addWriter
8,376
def removeReader(self, reader): """ Implement L{IReactorFDSet.removeReader}. """ wasLost = False try: fd = reader.fileno() except: fd = -1 if fd == -1: for fd, fdes in self._selectables.items(): if reader is fdes...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.removeReader
8,377
def removeWriter(self, writer): """ Implement L{IReactorFDSet.removeWriter}. """ wasLost = False try: fd = writer.fileno() except: fd = -1 if fd == -1: for fd, fdes in self._selectables.items(): if writer is fdes...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.removeWriter
8,378
def doKEvent(self, timeout): """ Poll the kqueue for new events. """ if timeout is None: timeout = 1 try: events = self._kq.control([], len(self._selectables), timeout) except __HOLE__ as e: # Since this command blocks for potentially ...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.doKEvent
8,379
def getAppBundleID(path): """Returns CFBundleIdentifier if available for application at path.""" infopath = os.path.join(path, 'Contents', 'Info.plist') if os.path.exists(infopath): try: plist = FoundationPlist.readPlist(infopath) if 'CFBundleIdentifier' in plist: ...
AttributeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getAppBundleID
8,380
def isItemInInstallInfo(manifestitem_pl, thelist, vers=''): """Determines if an item is in a manifest plist. Returns True if the manifest item has already been processed (it's in the list) and, optionally, the version is the same or greater. """ for item in thelist: try: if ...
KeyError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/isItemInInstallInfo
8,381
def updateAvailableLicenseSeats(installinfo): '''Records # of available seats for each optional install''' license_info_url = munkicommon.pref('LicenseInfoURL') if not license_info_url: # nothing to do! return if not installinfo.get('optional_installs'): # nothing to do! ...
ValueError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/updateAvailableLicenseSeats
8,382
def processInstall(manifestitem, cataloglist, installinfo, is_managed_update=False): """Processes a manifest item for install. Determines if it needs to be installed, and if so, if any items it is dependent on need to be installed first. Installation detail is added to installinfo['m...
TypeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/processInstall
8,383
def processManifestForKey(manifest, manifest_key, installinfo, parentcatalogs=None): """Processes keys in manifests to build the lists of items to install and remove. Can be recursive if manifests include other manifests. Probably doesn't handle circular manifest references we...
AttributeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/processManifestForKey
8,384
def getManifestData(manifestpath): '''Reads a manifest file, returns a dictionary-like object.''' plist = {} try: plist = FoundationPlist.readPlist(manifestpath) except FoundationPlist.NSPropertyListSerializationException: munkicommon.display_error('Could not read plist: %s', manifestpat...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getManifestData
8,385
def getManifestValueForKey(manifestpath, keyname): """Returns a value for keyname in manifestpath""" plist = getManifestData(manifestpath) try: return plist.get(keyname, None) except __HOLE__, err: munkicommon.display_error( 'Failed to get manifest value for key: %s (%s)', ...
AttributeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getManifestValueForKey
8,386
def getCatalogs(cataloglist): """Retrieves the catalogs from the server and populates our catalogs dictionary. """ #global CATALOG catalogbaseurl = munkicommon.pref('CatalogURL') or \ munkicommon.pref('SoftwareRepoURL') + '/catalogs/' if not catalogbaseurl.endswith('?') and ...
IOError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getCatalogs
8,387
def getmanifest(partialurl, suppress_errors=False): """Gets a manifest from the server. Returns: string local path to the downloaded manifest. """ #global MANIFESTS manifestbaseurl = (munkicommon.pref('ManifestURL') or munkicommon.pref('SoftwareRepoURL') + '/manifests/'...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getmanifest
8,388
def cleanUpManifests(): """Removes any manifest files that are no longer in use by this client""" manifest_dir = os.path.join( munkicommon.pref('ManagedInstallDir'), 'manifests') exceptions = [ "SelfServeManifest" ] for (dirpath, dirnames, filenames) in os.walk(manifest_dir, topdow...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/cleanUpManifests
8,389
def download_icons(item_list): '''Attempts to download icons (actually png files) for items in item_list''' icon_list = [] icon_known_exts = ['.bmp', '.gif', '.icns', '.jpg', '.jpeg', '.png', '.psd', '.tga', '.tif', '.tiff', '.yuv'] icon_base_url = (munkicommon.pref('IconUR...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/download_icons
8,390
def download_client_resources(): """Download client customization resources (if any).""" # Munki's preferences can specify an explicit name # under ClientResourcesFilename # if that doesn't exist, use the primary manifest name as the # filename. If that fails, try site_default.zip filenames = []...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/download_client_resources
8,391
def check(client_id='', localmanifestpath=None): """Checks for available new or updated managed software, downloading installer items if needed. Returns 1 if there are available updates, 0 if there are no available updates, and -1 if there were errors.""" global MACHINE munkicommon.getMachineFacts(...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/check
8,392
def getDataFromURL(url): '''Returns data from url as string. We use the existing getResourceIfChangedAtomically function so any custom authentication/authorization headers are reused''' urldata = os.path.join(munkicommon.tmpdir(), 'urldata') if os.path.exists(urldata): try: os.un...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/getDataFromURL
8,393
def handle(self, *fixture_labels, **options): using = options.get('database') connection = connections[using] self.style = no_style() if not len(fixture_labels): self.stderr.write( self.style.ERROR("No database fixture specified. Please provide the path of a...
KeyboardInterrupt
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/core/management/commands/loaddata.py/Command.handle
8,394
def _fill_to(self, index): if self._last >= index: return True while self._last < index: try: n = next(self._origin) except __HOLE__: return False self._last += 1 self._collection.append(n) return True
StopIteration
dataset/ETHPy150Open kachayev/fn.py/fn/stream.py/Stream._fill_to
8,395
def _run_with_timeout(p, timeout, kill_signal, kill_tree=True): """Return False if we timed out, True else.""" def alarm_handler(signum, frame): raise _Alarm if timeout == 0: # this is mostly useful for testing return False signal.signal(signal.SIGALRM, alarm_handler) signal....
OSError
dataset/ETHPy150Open Khan/alertlib/timeout.py/_run_with_timeout
8,396
def replace_url(self, url): if url.startswith('data:'): # Don't even both sending data: through urlparse(), # who knows how well it'll deal with a lot of data. return # Ignore any urls which are not relative parsed = urlparse.urlparse(url) if parsed.s...
OSError
dataset/ETHPy150Open miracle2k/webassets/src/webassets/filter/datauri.py/CSSDataUri.replace_url
8,397
def __init__(self, params): timeout = params.get('timeout', params.get('TIMEOUT', 300)) if timeout is not None: try: timeout = int(timeout) except (ValueError, TypeError): timeout = 300 self.default_timeout = timeout options = para...
ValueError
dataset/ETHPy150Open django/django/django/core/cache/backends/base.py/BaseCache.__init__
8,398
def semilinear(x): """ This function ensures that the values of the array are always positive. It is x+1 for x=>0 and exp(x) for x<0. """ try: # assume x is a numpy array shape = x.shape x.flatten() x = x.tolist() except __HOLE__: # no, it wasn't: build shape ...
AttributeError
dataset/ETHPy150Open pybrain/pybrain/pybrain/tools/functions.py/semilinear
8,399
def semilinearPrime(x): """ This function is the first derivative of the semilinear function (above). It is needed for the backward pass of the module. """ try: # assume x is a numpy array shape = x.shape x.flatten() x = x.tolist() except __HOLE__: # no, it wa...
AttributeError
dataset/ETHPy150Open pybrain/pybrain/pybrain/tools/functions.py/semilinearPrime