Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
7,900
def get_default_columns(self, with_aliases=False, col_aliases=None, start_alias=None, opts=None, as_pairs=False, local_only=False): """ Computes the default columns for selecting every field in the base model. Will sometimes be called to pull in related models (e.g. via selec...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/db/models/sql/compiler.py/GeoSQLCompiler.get_default_columns
7,901
def run(args): #Reset wipes the destination clean so we can start over. if args.reset: reset(args) #Set up validates the destination and source directories. #It also loads the previous state or creates one as necessary. state = setup(args) #We break out of this loop in batch mode and o...
KeyboardInterrupt
dataset/ETHPy150Open GraylinKim/sc2reader/examples/sc2autosave.py/run
7,902
def main(): parser = argparse.ArgumentParser( description='Automatically copy new replays to directory', fromfile_prefix_chars='@', formatter_class=sc2reader.scripts.utils.Formatter.new(max_help_position=35), epilog="And that's all folks") required = parser.add_argument_group('R...
KeyboardInterrupt
dataset/ETHPy150Open GraylinKim/sc2reader/examples/sc2autosave.py/main
7,903
def read(self, filename): """ Reads the file specified and parses the token elements generated from tokenizing the input data. `filename` Filename to read. Returns boolean. """ try: with open(filename, 'r') as _file: ...
IOError
dataset/ETHPy150Open xtrementl/focus/focus/parser/parser.py/SettingParser.read
7,904
def readstream(self, stream): """ Reads the specified stream and parses the token elements generated from tokenizing the input data. `stream` ``File``-like object. Returns boolean. """ self._reset() try: # tokenize i...
IOError
dataset/ETHPy150Open xtrementl/focus/focus/parser/parser.py/SettingParser.readstream
7,905
def write(self, filename, header=None): """ Writes the AST as a configuration file. `filename` Filename to save configuration file to. `header` Header string to use for the file. Returns boolean. """ origfile = self._file...
IOError
dataset/ETHPy150Open xtrementl/focus/focus/parser/parser.py/SettingParser.write
7,906
def writestream(self, stream, header=None): """ Writes the AST as a configuration file to the File-like stream. `stream` ``File``-like object. `header` Header string to use for the stream. Returns boolean. * Raises a ``ValueError...
IOError
dataset/ETHPy150Open xtrementl/focus/focus/parser/parser.py/SettingParser.writestream
7,907
def countGenesTranscripts(inlist, options): """count number of genes/transcripts in list.""" genes = {} transcripts = {} for x in inlist: try: species, transcript, gene = parseIdentifier(x, options) except __HOLE__: continue if species not in genes: ...
ValueError
dataset/ETHPy150Open CGATOxford/cgat/scripts/diff_transcript_sets.py/countGenesTranscripts
7,908
def getTranscriptsForGenes(genes, transcripts, options): """get transcripts for list of genes.""" result = [] for x in transcripts: try: species, transcript, gene = parseIdentifier(x, options) except __HOLE__: continue if gene in genes: result.ap...
ValueError
dataset/ETHPy150Open CGATOxford/cgat/scripts/diff_transcript_sets.py/getTranscriptsForGenes
7,909
def tagged_object_list(request, queryset_or_model=None, tag=None, related_tags=False, related_tag_counts=True, **kwargs): """ A thin wrapper around ``django.views.generic.list_detail.object_list`` which creates a ``QuerySet`` containing instances of the given queryset or model tagged with th...
KeyError
dataset/ETHPy150Open amarandon/smeuhsocial/apps/tagging/views.py/tagged_object_list
7,910
def getch(self): if self.lastChar == '': try: return self.iterator.next() except __HOLE__: return '' else: (ch, self.lastChar) = (self.lastChar, '') return ch
StopIteration
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/CharacterBufferFromIterable.getch
7,911
def isIterable(thing): """Returns true if 'thing' looks iterable.""" try: iter(thing) except __HOLE__: return False return True
TypeError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/isIterable
7,912
def isFileLike(thing): """Returns true if thing looks like a file.""" if hasattr(thing, "read") and hasattr(thing, "seek"): try: thing.seek(1, 1) thing.seek(-1, 1) return True except __HOLE__: pass return False
IOError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/isFileLike
7,913
def handleDecimalInt(buffer, optional=False, allowLeadingWhitespace=True): """Tries to scan for an integer. If 'optional' is set to False, returns None if an integer can't be successfully scanned.""" if allowLeadingWhitespace: handleWhitespace(buffer) ## eat leading spaces chars = [] chars...
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/handleDecimalInt
7,914
def handleOct(buffer): chars = [] chars += buffer.scanCharacterSet(_PLUS_MINUS_SET) chars += buffer.scanCharacterSet(_OCT_SET) try: return int(''.join(chars), 8) except __HOLE__: raise FormatError, ("invalid literal characters: %s" % ''.join(chars))
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/handleOct
7,915
def handleInt(buffer, base=0): chars = [] chars += buffer.scanCharacterSet(_PLUS_MINUS_SET) chars += buffer.scanCharacterSet("0") if chars and chars[-1] == '0': chars += buffer.scanCharacterSet("xX") chars += buffer.scanCharacterSet(_HEX_SET) try: return int(''.join(chars), base)...
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/handleInt
7,916
def handleFloat(buffer, allowLeadingWhitespace=True): if allowLeadingWhitespace: handleWhitespace(buffer) ## eat leading whitespace chars = [] chars += buffer.scanCharacterSet(_PLUS_MINUS_SET) chars += buffer.scanCharacterSet(_DIGIT_SET) chars += buffer.scanCharacterSet(".") chars += buf...
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/scanf.py/handleFloat
7,917
def _check_list_display_item(self, obj, model, item, label): if callable(item): return [] elif hasattr(obj, item): return [] elif hasattr(model, item): # getattr(model, item) could be an X_RelatedObjectsDescriptor try: field = model...
AttributeError
dataset/ETHPy150Open django/django/django/contrib/admin/checks.py/ModelAdminChecks._check_list_display_item
7,918
def _check_relation(self, obj, parent_model): try: _get_foreign_key(parent_model, obj.model, fk_name=obj.fk_name) except __HOLE__ as e: return [checks.Error(e.args[0], obj=obj.__class__, id='admin.E202')] else: return []
ValueError
dataset/ETHPy150Open django/django/django/contrib/admin/checks.py/InlineModelAdminChecks._check_relation
7,919
def rst_to_html(rst_text): try: from docutils.core import publish_string bootstrap_css_path = os.path.join(sublime.packages_path(), 'RstPreview/css/bootstrap.min.css') base_css_path = os.path.join(sublime.packages_path(), 'RstPreview/css/base.css') args = { 'stylesheet_pa...
ImportError
dataset/ETHPy150Open d0ugal-archive/RstPreview/RstPreview.py/rst_to_html
7,920
def __init__(self, simulation_cfg, default_wait_time_seconds=0.05, epsilon_time=0.05): super(PrefixPeeker, self).__init__(simulation_cfg, default_wait_time_seconds=default_wait_time_seconds, epsilon_time=epsilon_time) t...
ImportError
dataset/ETHPy150Open ucb-sts/sts/sts/control_flow/peeker.py/PrefixPeeker.__init__
7,921
def get_form(self, payment, data=None): if not payment.id: payment.save() xml_request = render_to_string( 'payments/sofort/new_transaction.xml', { 'project_id': self.project_id, 'language_code': get_language(), 'interface_version': ...
KeyError
dataset/ETHPy150Open mirumee/django-payments/payments/sofort/__init__.py/SofortProvider.get_form
7,922
def process_data(self, payment, request): if not 'trans' in request.GET: return HttpResponseForbidden('FAILED') transaction_id = request.GET.get('trans') payment.transaction_id = transaction_id transaction_request = render_to_string( 'payments/sofort/transaction_r...
KeyError
dataset/ETHPy150Open mirumee/django-payments/payments/sofort/__init__.py/SofortProvider.process_data
7,923
def test_singular_gh_3312(self): # "Bad" test case that leads SuperLU to call LAPACK with invalid # arguments. Check that it fails moderately gracefully. ij = np.array([(17, 0), (17, 6), (17, 12), (10, 13)], dtype=np.int32) v = np.array([0.284213, 0.94933781, 0.15767017, 0.38797296]) ...
RuntimeError
dataset/ETHPy150Open scipy/scipy/scipy/sparse/linalg/dsolve/tests/test_linsolve.py/TestLinsolve.test_singular_gh_3312
7,924
@property def main_menu(self): """ Returns Python object represents a menu """ try: return PluginManager().get_plugin_menu(self._main_menu) except __HOLE__: self._main_menu = sublime.decode_value(sublime.load_resource( "Packages/Javatar...
AttributeError
dataset/ETHPy150Open spywhere/Javatar/commands/menu.py/JavatarCommand.main_menu
7,925
def create_repo(name, attributes): config_parser = ConfigParser.RawConfigParser() values = ("name", "baseurl", "metalink", "mirrorlist", "gpgcheck", "gpgkey", "exclude", "includepkgs", "enablegroups...
AttributeError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/repos-plugin/yum-repos.py/create_repo
7,926
def _WaitForExternalIp(self, instance_name): """Waits for the instance to get external IP and returns it. Args: instance_name: Name of the Compute Engine instance. Returns: External IP address in string. Raises: ClusterSetUpError: External IP assignment times out. """ for _ in...
KeyError
dataset/ETHPy150Open GoogleCloudPlatform/Data-Pipeline/app/src/hadoop/hadoop_cluster.py/HadoopCluster._WaitForExternalIp
7,927
def do_show(request, event_id): service = str(request.GET.get('service', 'nova')) event_id = int(event_id) results = [] model = _model_factory(service) try: event = model.get(id=event_id) results = _append_raw_attributes(event, results, service) final = [results, ] j...
ObjectDoesNotExist
dataset/ETHPy150Open openstack/stacktach/stacktach/stacky_server.py/do_show
7,928
def search(request): service = str(request.GET.get('service', 'nova')) field = request.GET.get('field') value = request.GET.get('value') model = _model_factory(service) filters = {field: value} _add_when_filters(request, filters) results = [] try: events = model_search(request, ...
ObjectDoesNotExist
dataset/ETHPy150Open openstack/stacktach/stacktach/stacky_server.py/search
7,929
def _parse_created(created): try: created_datetime = datetime.datetime.strptime(created, '%Y-%m-%d') return dt.dt_to_decimal(created_datetime) except __HOLE__: raise BadRequestException( "'%s' value has an invalid format. It must be in YYYY-MM-DD format." % create...
ValueError
dataset/ETHPy150Open openstack/stacktach/stacktach/stacky_server.py/_parse_created
7,930
def _parse_id(id): try: return int(id) except __HOLE__: raise BadRequestException( "'%s' value has an invalid format. It must be in integer " "format." % id)
ValueError
dataset/ETHPy150Open openstack/stacktach/stacktach/stacky_server.py/_parse_id
7,931
def do_jsonreports_search(request): try: model = models.JsonReport filters = _create_query_filters(request) reports = model_search(request, model.objects, filters, order_by='-id') results = [['Id', 'Start', 'End', 'Created', 'Name', 'Version']] ...
ValidationError
dataset/ETHPy150Open openstack/stacktach/stacktach/stacky_server.py/do_jsonreports_search
7,932
def _crawl_config_files( self, root_dir='/', exclude_dirs=['proc', 'mnt', 'dev', 'tmp'], root_dir_alias=None, known_config_files=[], discover_config_files=False, ): assert(self.crawl_mode is not Modes.OUTCONTAINER) saved_args = locals() logge...
IOError
dataset/ETHPy150Open cloudviz/agentless-system-crawler/crawler/features_crawler.py/FeaturesCrawler._crawl_config_files
7,933
def _crawl_packages(self, dbpath=None, root_dir='/'): assert(self.crawl_mode is not Modes.OUTCONTAINER) # package attributes: ["installed", "name", "size", "version"] (installtime, name, version, size) = (None, None, None, None) if self.crawl_mode == Modes.INVM: logger.d...
OSError
dataset/ETHPy150Open cloudviz/agentless-system-crawler/crawler/features_crawler.py/FeaturesCrawler._crawl_packages
7,934
def get_temp_path(self, name=None): if name is None: name = os.urandom(20).encode('hex') dirname = self.info.env.temp_path try: os.makedirs(dirname) except __HOLE__: pass return os.path.join(dirname, name)
OSError
dataset/ETHPy150Open lektor/lektor-archive/lektor/admin/modules/common.py/AdminContext.get_temp_path
7,935
def sorted_list_difference(expected, actual): """Finds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual...
IndexError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/utils/unittest/util.py/sorted_list_difference
7,936
def unorderable_list_difference(expected, actual, ignore_duplicate=False): """Same behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance. """ missing = [] unexpected = [] while expected:...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/utils/unittest/util.py/unorderable_list_difference
7,937
@permission_required("core.manage_shop") def update_attachments(request, product_id): """Saves/deletes attachments with given ids (passed by request body). """ product = lfs_get_object_or_404(Product, pk=product_id) action = request.POST.get("action") message = _(u"Attachment has been updated.") ...
IndexError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/product/attachments.py/update_attachments
7,938
def transform(self, data): try: val = data[self.db_field] data[self.output_name] = val del data[self.db_field] except __HOLE__: data[self.output_name] = None return data
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/FieldNameTransform.transform
7,939
def transform(self, data): try: data.update(data[self.db_field]) del data[self.db_field] except __HOLE__: pass return data
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/FlattenFieldTransform.transform
7,940
def _contribute_fields(self, collection): is_primary = collection == self.primary_collection coll_name = collection._meta['collection'] try: excluded_fields = list(self.excluded_fields[coll_name]) except __HOLE__: excluded_fields = [] excluded_fields.appe...
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/Roller._contribute_fields
7,941
def _transform_field_name(self, collection_name, field_name): try: return self.field_transforms[collection_name][field_name].output_name except __HOLE__: return field_name
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/Roller._transform_field_name
7,942
def build_filters(self, **filter_kwargs): """ Returns a dictionary of Q objects that will be used to limit the mapper querysets. This allows for translating arguments from upstream code to the filter format used by the underlying data store abstraction. This will build...
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/Roller.build_filters
7,943
def build_filters_result(self, **filter_kwargs): try: return Q(reporting_level=filter_kwargs['reporting_level']) except __HOLE__: return None
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/Roller.build_filters_result
7,944
def get_fields(self): """ Returns a list of all fields encountered when building the flattened data with a call to get_list() This list is appropriate for writing a header row in a csv file using csv.DictWriter. """ try: return list(self._fields) ...
AttributeError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/Roller.get_fields
7,945
def build_filters_raw_result(self, **filter_kwargs): try: return Q(reporting_level=filter_kwargs['reporting_level']) except __HOLE__: return None
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/RawResultRoller.build_filters_raw_result
7,946
def get_items(self): """ Retrieve a flattened, filtered list of election results. Returns: A list of result dictionaries. By default, this is the value of ``self._items`` which should be populated with a call to ``collect_items()``. If results ...
AttributeError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/BaseBaker.get_items
7,947
def write(self, fmt='csv', outputdir=None, timestamp=None): """ Writes collected data to a file. Arguments: * fmt: Output format. Either 'csv' or 'json'. Default is 'csv'. * outputdir: Directory where output files will be written. Defaults to "openel...
AttributeError
dataset/ETHPy150Open openelections/openelections-core/openelex/base/bake.py/BaseBaker.write
7,948
def test_check(self): client = BlazeMeterClientEmul(logging.getLogger('')) client.results.append({"marker": "ping", 'result': {}}) client.results.append({"marker": "projects", 'result': []}) client.results.append({"marker": "project-create", 'result': { "id": time.time(), ...
KeyboardInterrupt
dataset/ETHPy150Open Blazemeter/taurus/tests/modules/test_blazeMeterUploader.py/TestBlazeMeterUploader.test_check
7,949
def test_hash(self): for obj_1, obj_2 in self.eq_pairs: try: if not hash(obj_1) == hash(obj_2): self.fail("%r and %r do not hash equal" % (obj_1, obj_2)) except __HOLE__: raise except Exception, e: self.fail(...
KeyboardInterrupt
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/unittest/test/support.py/TestHashing.test_hash
7,950
def popen_wrapper(args, os_err_exc_type=CommandError): """ Friendly wrapper around Popen. Returns stdout output, stderr output and OS status code. """ try: p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt', universal_newlines=True) except _...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/management/utils.py/popen_wrapper
7,951
def command(self, *args, **options): try: cover = args[0] cover = cover.lower() == "true" except __HOLE__: cover = False if cover: #Grab the pythonpath argument and look for tests there app_names = settings.INSTALLED_APPS #G...
IndexError
dataset/ETHPy150Open VikParuchuri/percept/percept/tests/commands/test.py/Command.command
7,952
def get_sli_manifest_part(self): part = {"columnName": self.name, "mode": "FULL", } if self.referenceKey: part["referenceKey"] = 1 if self.format: part['constraints'] = {'date': self.format} try: part['populates...
NotImplementedError
dataset/ETHPy150Open comoga/gooddata-python/gooddataclient/columns.py/Column.get_sli_manifest_part
7,953
def get_supported_platform(): """Return this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of Mac OS X that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version o...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/get_supported_platform
7,954
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except __HOLE__: __import__(mo...
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/get_provider
7,955
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ try: # Python 2.7 or >=3.2 from sysconfig import get_platform e...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/get_build_platform
7,956
@classmethod def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except __HOLE__: # The main program does not list any requirements return ws # ensure the requir...
ImportError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/WorkingSet._build_master
7,957
def get_default_cache(): """Determine the default cache location This returns the ``PYTHON_EGG_CACHE`` environment variable, if set. Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the "Application Data" directory. On all other systems, it's "~/.python-eggs". """ try: ...
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/get_default_cache
7,958
@classmethod def comparison(cls, nodelist): if len(nodelist) > 4: msg = "Chained comparison not allowed in environment markers" raise SyntaxError(msg) comp = nodelist[2][1] cop = comp[1] if comp[0] == token.NAME: if len(nodelist[2]) == 3: ...
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/MarkerEvaluation.comparison
7,959
@classmethod def _markerlib_evaluate(cls, text): """ Evaluate a PEP 426 environment marker using markerlib. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. """ from pip._vendor import _markerlib # mark...
NameError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/MarkerEvaluation._markerlib_evaluate
7,960
@classmethod def interpret(cls, nodelist): while len(nodelist)==2: nodelist = nodelist[1] try: op = cls.get_op(nodelist[0]) except __HOLE__: raise SyntaxError("Comparison or logical expression expected") return op(nodelist)
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/MarkerEvaluation.interpret
7,961
@classmethod def evaluate(cls, nodelist): while len(nodelist)==2: nodelist = nodelist[1] kind = nodelist[0] name = nodelist[1] if kind==token.NAME: try: op = cls.values[name] except __HOLE__: raise SyntaxError("Unknown name %r" ...
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/MarkerEvaluation.evaluate
7,962
def _index(self): try: return self._dirindex except __HOLE__: ind = {} for path in self.zipinfo: parts = path.split(os.sep) while parts: parent = os.sep.join(parts[:-1]) if parent in ind: ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/ZipProvider._index
7,963
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path, parent = sys.path, None if '.' in packageName: parent = '.'.join(packageName.spli...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/declare_namespace
7,964
def _normalize_cached(filename, _cache={}): try: return _cache[filename] except __HOLE__: _cache[filename] = result = normalize_path(filename) return result
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/_normalize_cached
7,965
def resolve(self): """ Resolve the entry point from its module and attrs. """ module = __import__(self.module_name, fromlist=['__name__'], level=0) try: return functools.reduce(getattr, self.attrs, module) except __HOLE__ as exc: raise ImportError(...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/EntryPoint.resolve
7,966
@property def key(self): try: return self._key except __HOLE__: self._key = key = self.project_name.lower() return key
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.key
7,967
@property def version(self): try: return self._version except __HOLE__: for line in self._get_metadata(self.PKG_INFO): if line.lower().startswith('version:'): self._version = safe_version(line.split(':',1)[1].strip()) re...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.version
7,968
@property def _dep_map(self): try: return self.__dep_map except __HOLE__: dm = self.__dep_map = {None: []} for name in 'requires.txt', 'depends.txt': for extra, reqs in split_sections(self._get_metadata(name)): if extra: ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution._dep_map
7,969
def requires(self, extras=()): """List of Requirements needed for this distro if `extras` are used""" dm = self._dep_map deps = [] deps.extend(dm.get(None, ())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except __HOLE__: ...
KeyError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.requires
7,970
def __str__(self): try: version = getattr(self, 'version', None) except __HOLE__: version = None version = version or "[unknown version]" return "%s %s" % (self.project_name, version)
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.__str__
7,971
def get_entry_map(self, group=None): """Return the entry point map for `group`, or the full entry map""" try: ep_map = self._ep_map except __HOLE__: ep_map = self._ep_map = EntryPoint.parse_map( self._get_metadata('entry_points.txt'), self ) ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.get_entry_map
7,972
def insert_on(self, path, loc = None): """Insert self.location in path before its nearest parent directory""" loc = loc or self.location if not loc: return nloc = _normalize_cached(loc) bdir = os.path.dirname(nloc) npath= [(p and _normalize_cached(p) or p) f...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.insert_on
7,973
def has_version(self): try: self.version except __HOLE__: issue_warning("Unbuilt egg for " + repr(self)) return False return True
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/Distribution.has_version
7,974
@property def _parsed_pkg_info(self): """Parse and cache metadata""" try: return self._pkg_info except __HOLE__: metadata = self.get_metadata(self.PKG_INFO) self._pkg_info = email.parser.Parser().parsestr(metadata) return self._pkg_info
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/DistInfoDistribution._parsed_pkg_info
7,975
@property def _dep_map(self): try: return self.__dep_map except __HOLE__: self.__dep_map = self._compute_dependencies() return self.__dep_map
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/DistInfoDistribution._dep_map
7,976
def issue_warning(*args,**kw): level = 1 g = globals() try: # find the first stack frame that is *not* code in # the pkg_resources module, to use for the warning while sys._getframe(level).f_globals is g: level += 1 except __HOLE__: pass warnings.warn(stac...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/issue_warning
7,977
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) def scan_list(ITEM, TERMINATOR, ...
StopIteration
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/parse_requirements
7,978
def testSystem( self ): """test system and environment functionality""" org = os.environ self._testCmds( javashell._shellEnv, testCmds, "default" ) # trigger initialization of environment os.environ[ key ] = value assert org.get( key, None ) == value, \ ...
KeyError
dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_javashell.py/JavaShellTest.testSystem
7,979
def chunk_assertion_blocks(text): chunks = [] buffer = None for lineno, line in enumerate(text.splitlines()): if not line.startswith('::'): if buffer: buffer[-1].append(line) continue tokens = line[2:].split() try: pragma, args = to...
IndexError
dataset/ETHPy150Open jek/flatland/tests/genshi/_util.py/chunk_assertion_blocks
7,980
def get_handler(self, *args, **options): if int(options['verbosity']) < 1: handler = WSGIHandler() else: handler = DevServerHandler() # AdminMediaHandler is removed in Django 1.5 # Add it only when it avialable. try: from django.core.servers.b...
ImportError
dataset/ETHPy150Open dcramer/django-devserver/devserver/management/commands/runserver.py/Command.get_handler
7,981
def inner_run(self, *args, **options): # Flag the server as active from devserver import settings import devserver settings.DEVSERVER_ACTIVE = True settings.DEBUG = True from django.conf import settings from django.utils import translation shutdown_messa...
KeyboardInterrupt
dataset/ETHPy150Open dcramer/django-devserver/devserver/management/commands/runserver.py/Command.inner_run
7,982
def get_next_adapter(self, intr_type='eth'): """ method to get the next adapter we'll want to always return an adapter with a 0 alias take the highest primary if exists, increment by 1 and return :param type: The type of network adapter :type type: st...
AttributeError
dataset/ETHPy150Open rtucker-mozilla/mozilla_inventory/systems/models.py/System.get_next_adapter
7,983
def read_handler(self): while 1: try: rl = self._poller.poll(0) except __HOLE__ as why: if why.errno == EINTR: continue else: raise else: break readysocks = [] ...
IOError
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/remote/pyro.py/PyroAsyncAdapter.read_handler
7,984
def collect_placement(self, it, app): _log.analyze(self._node.id, "+ BEGIN", {}, tb=True) if app._collect_placement_cb: app._collect_placement_cb.cancel() app._collect_placement_cb = None try: while True: _log.analyze(self._node.id, "+ ITER", {...
StopIteration
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/appmanager.py/AppManager.collect_placement
7,985
def select_actor(self, out_iter, kwargs, final, comp_name_desc): _log.analyze(self.node.id, "+", {'comp_name_desc': comp_name_desc}, tb=True) if final[0] and not kwargs['done']: kwargs['done'] = True for name, desc_list in kwargs['priority'].iteritems(): if desc_l...
KeyError
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/appmanager.py/Deployer.select_actor
7,986
def deploy_unhandled_actors(self, comp_name_desc): while True: try: name, desc = comp_name_desc.next() _log.analyze(self.node.id, "+", {'name': name, 'desc': desc}, tb=True) except __HOLE__: # Done if self._deploy_cont_done:...
StopIteration
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/appmanager.py/Deployer.deploy_unhandled_actors
7,987
def set(self, value): """Assign the native and Unicode value. :returns: True if adaptation of *value* was successful. Attempts to adapt the given value and assigns this element's :attr:`~flatland.Element.value` and :attr:`u` attributes in tandem. If adaptation succeeds...
UnicodeDecodeError
dataset/ETHPy150Open jek/flatland/flatland/schema/scalars.py/Scalar.set
7,988
def adapt(self, value): """Generic numeric coercion. :returns: an instance of :attr:`type_` or ``None`` Attempt to convert *value* using the class's :attr:`type_` callable. """ if value is None: return None if isinstance(value, basestring): valu...
TypeError
dataset/ETHPy150Open jek/flatland/flatland/schema/scalars.py/Number.adapt
7,989
def adapt(self, value): """Coerces value to a native type. If *value* is an instance of :attr:`type_`, returns it unchanged. If a string, attempts to parse it and construct a :attr:`type` as described in the attribute documentation. """ if value is None: re...
ValueError
dataset/ETHPy150Open jek/flatland/flatland/schema/scalars.py/Temporal.adapt
7,990
def test_soft_remove_silent_on_no_file(self): try: util.remove(self.path + 'XXX', True) except __HOLE__: self.fail(u'OSError when removing path')
OSError
dataset/ETHPy150Open beetbox/beets/test/test_files.py/SoftRemoveTest.test_soft_remove_silent_on_no_file
7,991
def find_modules(modules_dir): try: return [f[:-3] for f in os.listdir(modules_dir) if not f.startswith('_') and f.endswith('.py')] except __HOLE__: return []
OSError
dataset/ETHPy150Open felinx/d3status/d3status/libs/utils.py/find_modules
7,992
@exceptions_handled @marshal_with(responses_v2_1.MaintenanceMode) def post(self, maintenance_action, **_): maintenance_file_path = get_maintenance_file_path() if maintenance_action == 'activate': if os.path.isfile(maintenance_file_path): state = utils.read_json_file(...
AttributeError
dataset/ETHPy150Open cloudify-cosmo/cloudify-manager/rest-service/manager_rest/resources_v2_1.py/MaintenanceModeAction.post
7,993
def test_sda(): skip.skip_if_no_data() yaml_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) save_path = os.path.dirname(os.path.realpath(__file__)) train_layer1(yaml_file_path, save_path) train_layer2(yaml_file_path, sav...
OSError
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/tutorials/stacked_autoencoders/tests/test_dae.py/test_sda
7,994
def check_pid(self, pid): if os.name == 'nt': try: import ctypes # returns 0 if no such process (of ours) exists # positive int otherwise p = ctypes.windll.kernel32.OpenProcess(1,0,pid) except Exception: self...
OSError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/baseapp.py/BaseParallelApplication.check_pid
7,995
@title.setter def title(self, value): """Set a sheet title, ensuring it is valid. Limited to 31 characters, no special characters.""" if hasattr(value, "decode"): if not isinstance(value, unicode): try: value = value.decode("ascii") ...
UnicodeDecodeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/worksheet/worksheet.py/Worksheet.title
7,996
def nrhead(): try: import newrelic.agent except __HOLE__: return '' return newrelic.agent.get_browser_timing_header()
ImportError
dataset/ETHPy150Open jupyter/nbviewer/nbviewer/app.py/nrhead
7,997
def nrfoot(): try: import newrelic.agent except __HOLE__: return '' return newrelic.agent.get_browser_timing_footer()
ImportError
dataset/ETHPy150Open jupyter/nbviewer/nbviewer/app.py/nrfoot
7,998
def run_cmd(cmd, attempts=1): """ Runs a command attempts times, logging its output. Returns True if it succeeds once, or False if it never does. """ try: for i in range(attempts): proc = subprocess.Popen(cmd, stdin=open(devnull, "r")) proc.wait() if not proc.retu...
OSError
dataset/ETHPy150Open CiscoCloud/mantl/testing/build-cluster.py/run_cmd
7,999
def _close_callback(self): """Callback called when redis closed the connection. The callback queue is emptied and we call each callback found with None or with an exception object to wake up blocked client. """ while True: try: callback = self.__callb...
IndexError
dataset/ETHPy150Open thefab/tornadis/tornadis/client.py/Client._close_callback