function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
def get_links_setup(self): '''Returns setup for documents related to this doctype. This method will return the `links_setup` property in the `[doctype]_links.py` file in the doctype folder''' try: module = load_doctype_module(self.name, suffix='_links') return frappe._dict(module.links) except __HOLE__...
ImportError
dataset/ETHPy150Open frappe/frappe/frappe/model/meta.py/Meta.get_links_setup
def is_single(doctype): try: return frappe.db.get_value("DocType", doctype, "issingle") except __HOLE__: raise Exception, 'Cannot determine whether %s is single' % doctype
IndexError
dataset/ETHPy150Open frappe/frappe/frappe/model/meta.py/is_single
def dis(x=None): """Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. """ if x is None: distb() return if type(x) is types.InstanceType: x = x.__class__ if hasattr(x, 'im_func'): x = x.im_func if hasattr(x, '...
TypeError
dataset/ETHPy150Open babble/babble/include/jython/Lib/dis.py/dis
def distb(tb=None): """Disassemble a traceback (default: last traceback).""" if tb is None: try: tb = sys.last_traceback except __HOLE__: raise RuntimeError, "no last traceback to disassemble" while tb.tb_next: tb = tb.tb_next disassemble(tb.tb_frame.f_code, t...
AttributeError
dataset/ETHPy150Open babble/babble/include/jython/Lib/dis.py/distb
def parse_py(codelet): """ Adds 'symbols' field to the codelet after parsing the python code. :param codelet: The codelet object to parsed. :type code: Codelet """ def strip_encoding(lines): """Strips the encoding line from a file, which breaks the parser.""" it = iter(lines) ...
StopIteration
dataset/ETHPy150Open earwig/bitshift/bitshift/parser/python.py/parse_py
def identifyAspectsUsed(self): # relationshipSets are a dts property self.relationshipSets = [(arcrole, ELR, linkqname, arcqname) for arcrole, ELR, linkqname, arcqname in self.modelXbrl.baseSets.keys() if ELR and (arcrole.startswith("XBRL...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticSqlDB.py/XbrlSqlDatabaseConnection.identifyAspectsUsed
def insertDataPoints(self): reportId = self.reportId if self.filingPreviouslyInDB: self.showStatus("deleting prior data points of this report") # remove prior facts self.lockTables(("data_point", "entity_identifier", "period", "aspect_value_selection", ...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticSqlDB.py/XbrlSqlDatabaseConnection.insertDataPoints
def mkdir_p(path): # From https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python try: os.makedirs(path) except __HOLE__ as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise
OSError
dataset/ETHPy150Open yosinski/deep-visualization-toolbox/misc.py/mkdir_p
@wsgi.action("update") def update(self, req, id, body): """Configure cloudpipe parameters for the project.""" context = req.environ['nova.context'] authorize(context) if id != "configure-project": msg = _("Unknown action %s") % id raise webob.exc.HTTPBadRequ...
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/cloudpipe_update.py/CloudpipeUpdateController.update
def stop(self): """ Stops the server. If the server is not running, this method has no effect. """ if self.started: try: self.httpd.shutdown() self.httpd.server_close() self.server_thread.join() self.ser...
AttributeError
dataset/ETHPy150Open w3c/wptserve/wptserve/server.py/WebTestHttpd.stop
def __init__(self, config): self.config = config self.filename = config.get('nagios.command_file') try: self.pipe = open(self.filename, 'a') except (IOError, __HOLE__), e: self.pipe = None
OSError
dataset/ETHPy150Open tehmaze/nagios-cli/nagios_cli/nagios.py/Command.__init__
def parse(self, filename, limit=None): if limit is not None: self.limit = limit retry = 10 handle = None while handle is None: try: handle = open(filename, 'rb') except: retry -= 1 if retry: ...
ValueError
dataset/ETHPy150Open tehmaze/nagios-cli/nagios_cli/nagios.py/Parser.parse
def _smooth(self, efold, y): try: y.size > self.lookback except __HOLE__: 'Y must have at least self.lookback elements.' ysmooth = np.zeros(y.size) ysmooth[0] = y[0] peffective = 0.0 # trace of the smoothing matrix, the effective number of parameters ...
ValueError
dataset/ETHPy150Open brandonckelly/bck_stats/bck_stats/gcv_smoother.py/GcvExpSmoother._smooth
def order(subgraph): """ Return the number of unique nodes in a subgraph. :arg subgraph: :return: """ try: return subgraph.__order__() except AttributeError: try: return len(set(subgraph.nodes())) except __HOLE__: raise TypeError("Object %r is not...
AttributeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/order
def size(subgraph): """ Return the number of unique relationships in a subgraph. :arg subgraph: :return: """ try: return subgraph.__size__() except AttributeError: try: return len(set(subgraph.relationships())) except __HOLE__: raise TypeError("Ob...
AttributeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/size
def walk(*walkables): """ Traverse over the arguments supplied, yielding the entities from each in turn. :arg walkables: sequence of walkable objects """ if not walkables: return walkable = walkables[0] try: entities = walkable.__walk__() except AttributeError: r...
AttributeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/walk
def __eq__(self, other): try: return self.nodes() == other.nodes() and self.relationships() == other.relationships() except __HOLE__: return False
AttributeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/Subgraph.__eq__
def __eq__(self, other): try: other_walk = tuple(walk(other)) except __HOLE__: return False else: return tuple(walk(self)) == other_walk
TypeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/Walkable.__eq__
def __setitem__(self, key, value): if value is None: try: dict.__delitem__(self, key) except __HOLE__: pass else: dict.__setitem__(self, key, coerce_property(value))
KeyError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/PropertyDict.__setitem__
def remote(obj): """ Return the remote counterpart of a local object. :param obj: the local object :return: the corresponding remote entity """ try: return obj.__remote__ except __HOLE__: return None
AttributeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/remote
def __eq__(self, other): if other is None: return False try: other = cast_relationship(other) except __HOLE__: return False else: remote_self = remote(self) remote_other = remote(other) if remote_self and remote_othe...
TypeError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/Relationship.__eq__
def __init__(self, *entities): entities = list(entities) for i, entity in enumerate(entities): if isinstance(entity, Entity): continue elif entity is None: entities[i] = Node() elif isinstance(entity, dict): entities[i] ...
IndexError
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/types.py/Path.__init__
def CollapseTree(self): try: self.CollapseAllChildren(self.root_id) except __HOLE__: self.Collapse(self.root_id) self.Expand(self.root_id) ######################################################################## ### ### EVENT TREE (ORDERED BY DATES AND IDS) ###
AttributeError
dataset/ETHPy150Open cmpilato/thotkeeper/lib/tk_main.py/TKTreeCtrl.CollapseTree
def import_preferred_memcache_lib(self, servers): """Returns an initialized memcache client. Used by the constructor.""" try: import pylibmc except ImportError: pass else: return pylibmc.Client(servers) try: from google.appengine....
ImportError
dataset/ETHPy150Open jojoin/cutout/cutout/cache/memcachedcache.py/MemcachedCache.import_preferred_memcache_lib
def poll(self): try: command = [self.config['bin'], '-1'] if str_to_bool(self.config['use_sudo']): command.insert(0, self.config['sudo_cmd']) output = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0] ...
OSError
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/varnish/varnish.py/VarnishCollector.poll
def parse_arg(s): try: return json.loads(s) except __HOLE__: return s
ValueError
dataset/ETHPy150Open aerospike/aerospike-client-python/examples/client/scan_apply.py/parse_arg
def copy_test_to_media(module, name): """ Copies a file from Mezzanine's test data path to MEDIA_ROOT. Used in tests and demo fixtures. """ mezzanine_path = path_for_import(module) test_path = os.path.join(mezzanine_path, "static", "test", name) to_path = os.path.join(settings.MEDIA_ROOT, na...
OSError
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/utils/tests.py/copy_test_to_media
def run_version_check(): logging.info("Performing version check.") logging.info("Current version: %s", current_version) data = json_dumps({ 'current_version': current_version }) headers = {'content-type': 'application/json'} try: response = requests.post('https://version.redash...
ValueError
dataset/ETHPy150Open getredash/redash/redash/version_check.py/run_version_check
def getOsCredentialsFromEnvironment(): credentials = {} try: credentials['VERSION'] = os.environ['OS_COMPUTE_API_VERSION'] credentials['USERNAME'] = os.environ['OS_USERNAME'] credentials['PASSWORD'] = os.environ['OS_PASSWORD'] credentials['TENANT_NAME'] = os.environ['OS_TENANT_NAME'] credentials['AUTH_URL']...
KeyError
dataset/ETHPy150Open lukaspustina/dynamic-inventory-for-ansible-with-openstack/openstack_inventory.py/getOsCredentialsFromEnvironment
def _GetClusterDescription(project, zone, cluster_name): """Gets the description for a Cloud Bigtable cluster. Args: project: str. Name of the project in which the cluster was created. zone: str. Zone of the project in which the cluster was created. cluster_name: str. Cluster ID of the desired Bigtable...
KeyError
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_benchmarks/cloud_bigtable_ycsb_benchmark.py/_GetClusterDescription
def _GetDefaultProject(): cmd = [FLAGS.gcloud_path, 'config', 'list', '--format', 'json'] stdout, stderr, return_code = vm_util.IssueCommand(cmd) if return_code: raise subprocess.CalledProcessError(return_code, cmd, stdout) config = json.loads(stdout) try: return config['core']['project'] except _...
KeyError
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_benchmarks/cloud_bigtable_ycsb_benchmark.py/_GetDefaultProject
def test_common_rules(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator() dataset = [ ('valid@example.com', ''), ('', 'It cannot be empty.'), ('*' * 256, 'It cannot be longer than 255 chars.'), ('.invalid@example.com', 'It cannot start with a dot.'), ...
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_common_rules
def test_common_rules_fixed(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator(fix=True) dataset = [ ('.fixme@example.com', ('fixme@example.com', '')), ('fixme@example.com.', ('fixme@example.com', '')), ] def closure(address, expect): assert mock._apply_c...
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_common_rules_fixed
def test_domain_validation_basic(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator() dataset = [ ('example.com', ''), ('xn--ls8h.la', ''), # IDN: (poop).la ('', 'Invalid domain: It cannot be empty.'), ('-bad.example.com', 'Invalid domain.'), ] def cl...
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_domain_validation_basic
def test_domain_lookup(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator() dataset = [ ('gothcandy.com', 'a', '174.129.236.35'), ('a' * 64 + '.gothcandy.com', 'a', False), ('gothcandy.com', 'mx', [(10, 'mx1.emailsrvr.com'), (20, 'mx2.emailsrvr.com')]), (...
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_domain_lookup
def test_domain_validation(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator(lookup_dns='mx') dataset = [ ('example.com', 'Domain does not seem to exist.'), # TODO This domain is always erroring out, please do something # ('xn--ls8h.la', ''), # IDN: (poop)....
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_domain_validation
def test_bad_lookup_record_1(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") with pytest.raises(RuntimeError): DomainValidator(lookup_dns='cname')
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_bad_lookup_record_1
def test_bad_lookup_record_2(): try: import DNS except __HOLE__: pytest.skip("PyDNS not installed.") mock = DomainValidator() with pytest.raises(RuntimeError): mock.lookup_domain('example.com', 'cname')
ImportError
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_bad_lookup_record_2
def fit(self, X, y, method='smoother', delta=None, include_constant=None): """ Fit the coefficients for the dynamic linear model. @param method: The method used to estimate the dynamic coefficients, either 'smoother' or 'filter'. If 'smoother', then the Kalman Smoother is used, othe...
ValueError
dataset/ETHPy150Open brandonckelly/bck_stats/bck_stats/dynamic_linear_model.py/DynamicLinearModel.fit
def get_url_data(self, url): parsed_url = urlparse.urlsplit(url) if (parsed_url.scheme in self.schemes and parsed_url.netloc in self.netlocs and parsed_url.path == self.path): parsed_qs = urlparse.parse_qs(parsed_url.query) try: ret...
IndexError
dataset/ETHPy150Open pculture/vidscraper/vidscraper/suites/kaltura.py/Feed.get_url_data
def __getitem__(self, entity_class): """Return an :class:`EntityExtent` for the given entity class. This extent can be used to access the set of entities of that class in the world or to query these entities via their components. Examples:: world[MyEntity] world[...] :param entity_class: The entity ...
KeyError
dataset/ETHPy150Open caseman/grease/grease/world.py/World.__getitem__
def remove(self, entity): """Remove the entity from the set and, world components, and all necessary class sets """ super(WorldEntitySet, self).remove(entity) for component in self.world.components: try: del component[entity] except __HOLE__: pass for cls in entity.__class__.__mro__: if iss...
KeyError
dataset/ETHPy150Open caseman/grease/grease/world.py/WorldEntitySet.remove
def discard(self, entity): """Remove the entity from the set if it exists, if not, do nothing """ try: self.remove(entity) except __HOLE__: pass
KeyError
dataset/ETHPy150Open caseman/grease/grease/world.py/WorldEntitySet.discard
def get_repo_node(env, repo_name, node): try: from tracopt.versioncontrol.git.PyGIT import GitError except __HOLE__: ## Pre-1.0 Trac from tracext.git.PyGIT import GitError from trac.core import TracError try: repo = env.get_repository(reponame=repo_name) return repo.get_n...
ImportError
dataset/ETHPy150Open boldprogressives/trac-GitolitePlugin/trac_gitolite/utils.py/get_repo_node
def create(self, args): """ Create a new user. """ if not self.settings.user_registration_enabled: print messages['RegisterDisabled'].format(self.settings.user_registration_url) return self.api.set_token(None) if args.name and args.email and a...
NotImplementedError
dataset/ETHPy150Open cloudControl/cctrl/cctrl/user.py/UserController.create
def activate(self, args): """ Activate a new user using the information from the activation email. """ self.api.set_token(None) try: self.api.update_user( args.user_name[0], activation_code=args.activation_code[0]) ...
NotImplementedError
dataset/ETHPy150Open cloudControl/cctrl/cctrl/user.py/UserController.activate
def delete(self, args): """ Delete your user account. """ users = self.api.read_users() if not args.force_delete: question = raw_input('Do you really want to delete your user? ' + 'Type "Yes" without the quotes to delete: ') ...
NotImplementedError
dataset/ETHPy150Open cloudControl/cctrl/cctrl/user.py/UserController.delete
def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'): """ Similar to smart_unicode, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects. """ # Handle the common case fi...
UnicodeDecodeError
dataset/ETHPy150Open xiaoxu193/PyTeaser/goose/utils/encoding.py/force_unicode
def build_wigtrack (self): """Use this function to return a WigTrackI. """ data = WigTrackI() add_func = data.add_loc chrom = "Unknown" span = 0 pos_fixed = 0 # pos for fixedStep data 0: variableStep, 1: fixedStep for i in self.fhd: if i....
ValueError
dataset/ETHPy150Open taoliu/taolib/CoreLib/Parser/WiggleIO.py/WiggleIO.build_wigtrack
def build_binKeeper (self,chromLenDict={},binsize=200): """Use this function to return a dictionary of BinKeeper objects. chromLenDict is a dictionary for chromosome length like {'chr1':100000,'chr2':200000} bin is in bps. for detail, check BinKeeper. """ data ...
ValueError
dataset/ETHPy150Open taoliu/taolib/CoreLib/Parser/WiggleIO.py/WiggleIO.build_binKeeper
def verify_files(files, user): ''' Verify that the named files exist and are owned by the named user ''' if salt.utils.is_windows(): return True import pwd # after confirming not running Windows try: pwnam = pwd.getpwnam(user) uid = pwnam[2] except __HOLE__: ...
KeyError
dataset/ETHPy150Open saltstack/salt/salt/utils/verify.py/verify_files
def verify_env(dirs, user, permissive=False, pki_dir='', skip_extra=False): ''' Verify that the named directories are in place and that the environment can shake the salt ''' if salt.utils.is_windows(): return True import pwd # after confirming not running Windows try: pwnam...
KeyError
dataset/ETHPy150Open saltstack/salt/salt/utils/verify.py/verify_env
def check_user(user): ''' Check user and assign process uid/gid. ''' if salt.utils.is_windows(): return True if user == salt.utils.get_user(): return True import pwd # after confirming not running Windows try: pwuser = pwd.getpwnam(user) try: if h...
KeyError
dataset/ETHPy150Open saltstack/salt/salt/utils/verify.py/check_user
def valid_id(opts, id_): ''' Returns if the passed id is valid ''' try: return bool(clean_path(opts['pki_dir'], id_)) except (__HOLE__, KeyError) as e: return False
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/utils/verify.py/valid_id
def run(self): import os try: os.remove(self.outputs[0].abspath()) except __HOLE__: pass return os.symlink(self.inputs[0].abspath(), self.outputs[0].abspath())
OSError
dataset/ETHPy150Open hwaf/hwaf/py-hwaftools/hwaf-rules.py/symlink_tsk.run
def run(self): """ Execute the test. The execution is always successful, but the results are stored on ``self.generator.bld.hwaf_utest_results`` for postprocessing. """ filename = self.inputs[0].abspath() self.ut_exec = getattr(self.generator, 'ut_exec', [filename]) ...
AttributeError
dataset/ETHPy150Open hwaf/hwaf/py-hwaftools/hwaf-rules.py/hwaf_utest.run
def _request(self, remaining, headers = {}): remaining = self._inject_extension(remaining) if '?' in remaining: context_remaining = remaining + '&context_id=' + self.context_id else: context_remaining = remaining + '?context_id=' + self.context_id url = '%s%s' % ...
ValueError
dataset/ETHPy150Open gateway4labs/labmanager/labmanager/rlms/ext/rest.py/RLMS._request
def __cmp__(self, other): try: return cmp(self.name, other.name) except __HOLE__: return 0
AttributeError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Memoize.py/Counter.__cmp__
def __call__(self, *args, **kw): obj = args[0] try: memo_dict = obj._memo[self.method_name] except __HOLE__: self.miss = self.miss + 1 else: key = self.keymaker(*args, **kw) if key in memo_dict: self.hit = self.hit + 1 ...
KeyError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Memoize.py/CountDict.__call__
def generate(env): try: env['BUILDERS']['PDF'] except __HOLE__: global PDFBuilder if PDFBuilder is None: PDFBuilder = SCons.Builder.Builder(action = {}, source_scanner = SCons.Tool.PDFLaTeXScanner, ...
KeyError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/pdf.py/generate
def GetWithRetries(self, uri, extra_headers=None, redirects_remaining=4, encoding='UTF-8', converter=None, num_retries=DEFAULT_NUM_RETRIES, delay=DEFAULT_DELAY, backoff=DEFAULT_BACKOFF, logger=None): """This is a wrapper method for Get with retrying capability. To avoid various errors while retrie...
SystemExit
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/service.py/GDataService.GetWithRetries
@staticmethod def gf(ctx, obj, path): ''' find file in vim like rule - search relative to the directory of the current file - search in the git root directory return Blob/Tree/LinkObject or None if no file found ''' try: return obj.parent[path] ...
KeyError
dataset/ETHPy150Open nakamuray/blikit/blikit/docutilsext.py/HTMLTranslator.gf
def run(self): is_recursive = not 'no-recursive' in self.options order_by = self.options.get('order_by', 'name') is_reverse = 'reverse' in self.options max_count = self.options.get('count', None) pattern = self.options.get('pattern', None) show_hidden = 'show-hidden' in s...
KeyError
dataset/ETHPy150Open nakamuray/blikit/blikit/docutilsext.py/ShowContents.run
def test_required_args(self): # required arg missing try: getargs_keywords(arg1=(1,2)) except __HOLE__, err: self.assertEqual(str(err), "Required argument 'arg2' (pos 2) not found") else: self.fail('TypeError should have been raised')
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_getargs2.py/Keywords_TestCase.test_required_args
def test_too_many_args(self): try: getargs_keywords((1,2),3,(4,(5,6)),(7,8,9),10,111) except __HOLE__, err: self.assertEqual(str(err), "function takes at most 5 arguments (6 given)") else: self.fail('TypeError should have been raised')
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_getargs2.py/Keywords_TestCase.test_too_many_args
def test_invalid_keyword(self): # extraneous keyword arg try: getargs_keywords((1,2),3,arg5=10,arg666=666) except __HOLE__, err: self.assertEqual(str(err), "'arg666' is an invalid keyword argument for this function") else: self.fail('TypeError should h...
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_getargs2.py/Keywords_TestCase.test_invalid_keyword
def test_main(): tests = [Signed_TestCase, Unsigned_TestCase, Tuple_TestCase, Keywords_TestCase] try: from _testcapi import getargs_L, getargs_K except __HOLE__: pass # PY_LONG_LONG not available else: tests.append(LongLong_TestCase) test_support.run_unittest(*tests)
ImportError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_getargs2.py/test_main
def _parse_volumes(volumes): ''' Parse a given volumes state specification for later use in modules.docker.create_container(). This produces a dict that can be directly consumed by the Docker API /containers/create. Note: this only really exists for backwards-compatibility, and because modules....
IndexError
dataset/ETHPy150Open saltstack/salt/salt/states/dockerio.py/_parse_volumes
@core_cmd.command() @click.option('--ipython/--no-ipython', default=True) def shell(ipython): """Runs a Python shell with Quokka context""" import code import readline import rlcompleter _vars = globals() _vars.update(locals()) _vars.update(dict(app=app, db=db)) readline.set_completer(rl...
ImportError
dataset/ETHPy150Open rochacbruno/quokka/manage.py/shell
def pull(server, secret, name): """ Pull a blueprint from the secret and name on the configured server. """ r = http.get('/{0}/{1}'.format(secret, name), server=server) if 200 == r.status: b = Blueprint.load(r, name) for filename in b.sources.itervalues(): logging.info('...
OSError
dataset/ETHPy150Open devstructure/blueprint/blueprint/io/__init__.py/pull
def __get__(self, obj, type=None): if obj is None: return self.fget # Get the cache or set a default one if needed _cachename = self.cachename _cache = getattr(obj, _cachename, None) if _cache is None: setattr(obj, _cachename, resettable_cache()) ...
AttributeError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tools/decorators.py/CachedAttribute.__get__
def __set__(self, obj, value): _cache = getattr(obj, self.cachename) name = self.name try: _cache[name] = value except __HOLE__: setattr(_cache, name, value)
KeyError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tools/decorators.py/CachedWritableAttribute.__set__
def release_resources(self): # TODO: implement in entirety path = self.get_resource_path() for fname in glob.glob(path): try: os.remove(fname) except __HOLE__: pass # os.remove(path)
OSError
dataset/ETHPy150Open codelucas/newspaper/newspaper/article.py/Article.release_resources
def set_reddit_top_img(self): """Wrapper for setting images. Queries known image attributes first, then uses Reddit's image algorithm as a fallback. """ try: s = images.Scraper(self) self.set_top_img(s.largest_image_url()) except __HOLE__ as e: ...
TypeError
dataset/ETHPy150Open codelucas/newspaper/newspaper/article.py/Article.set_reddit_top_img
def __init__(self, domain=None, idstring=None): self.domain = str(domain or DNS_NAME) try: pid = os.getpid() except __HOLE__: # No getpid() in Jython. pid = 1 self.idstring = ".".join([str(idstring or randrange(10000)), str(pid)])
AttributeError
dataset/ETHPy150Open lavr/python-emails/emails/utils.py/MessageID.__init__
def GetGoogleSqlOAuth2RefreshToken(oauth_file_path): """Reads the user's Google Cloud SQL OAuth2.0 token from disk.""" if not os.path.exists(oauth_file_path): return None try: with open(oauth_file_path) as oauth_file: token = simplejson.load(oauth_file) return token['refresh_token'] except (...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/GetGoogleSqlOAuth2RefreshToken
def LoadTargetModule(handler_path, cgi_path, import_hook, module_dict=sys.modules): """Loads a target CGI script by importing it as a Python module. If the module for the target CGI script has already been loaded before, the new module will be loaded...
UnicodeDecodeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/LoadTargetModule
def ExecuteOrImportScript(config, handler_path, cgi_path, import_hook): """Executes a CGI script by importing it as a new module. This possibly reuses the module's main() function if it is defined and takes no arguments. Basic technique lifted from PEP 338 and Python2.5's runpy module. See: http://www.pyt...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ExecuteOrImportScript
def ExecuteCGI(config, root_path, handler_path, cgi_path, env, infile, outfile, module_dict, exec_script=ExecuteOrImportScript, exec_py27_handler=ExecutePy27Handler): """Executes Pyth...
SystemExit
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ExecuteCGI
def ReadDataFile(data_path, openfile=file): """Reads a file on disk, returning a corresponding HTTP status and data. Args: data_path: Path to the file on disk to read. openfile: Used for dependency injection. Returns: Tuple (status, data) where status is an HTTP response code, and data is the ...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ReadDataFile
def ValidHeadersRewriter(response): """Remove invalid response headers. Response headers must be printable ascii characters. This is enforced in production by http_proto.cc IsValidHeader. This rewriter will remove headers that contain non ascii characters. """ for (key, value) in response.headers.items():...
UnicodeDecodeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ValidHeadersRewriter
def ParseStatusRewriter(response): """Parse status header, if it exists. Handles the server-side 'status' header, which instructs the server to change the HTTP response code accordingly. Handles the 'location' header, which issues an HTTP 302 redirect to the client. Also corrects the 'content-length' header ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ParseStatusRewriter
def AreModuleFilesModified(self): """Determines if any monitored files have been modified. Returns: True if one or more files have been modified, False otherwise. """ for name, (mtime, fname) in self._modification_times.iteritems(): if name not in self._modules: continue mod...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ModuleManager.AreModuleFilesModified
def UpdateModuleFileModificationTimes(self): """Records the current modification times of all monitored modules.""" if not self._dirty: return self._modification_times.clear() for name, module in self._modules.items(): if not isinstance(module, types.ModuleType): continue modu...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ModuleManager.UpdateModuleFileModificationTimes
def CreateRequestHandler(root_path, login_url, static_caching=True, default_partition=None, interactive_console=True, secret_hash='xxx'): """Creates a new BaseHTTPRequestHandler sub-class. T...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/CreateRequestHandler
def ReadAppConfig(appinfo_path, parse_app_config=appinfo_includes.Parse): """Reads app.yaml file and returns its app id and list of URLMap instances. Args: appinfo_path: String containing the path to the app.yaml file. parse_app_config: Used for dependency injection. Returns: AppInfoExternal instanc...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ReadAppConfig
def ReadCronConfig(croninfo_path, parse_cron_config=croninfo.LoadSingleCron): """Reads cron.yaml file and returns a list of CronEntry instances. Args: croninfo_path: String containing the path to the cron.yaml file. parse_cron_config: Used for dependency injection. Returns: A CronInfoExternal object...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ReadCronConfig
def _RemoveFile(file_path): if file_path and os.path.lexists(file_path): logging.info('Attempting to remove file at %s', file_path) try: os.remove(file_path) except __HOLE__, e: logging.warning('Removing file failed: %s', e)
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/_RemoveFile
def SetupStubs(app_id, **config): """Sets up testing stubs of APIs. Args: app_id: Application ID being served. config: keyword arguments. Keywords: root_path: Root path to the directory of the application which should contain the app.yaml, index.yaml, and queue.yaml files. login_url: Rel...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/SetupStubs
def start(self): self.instructions() # start ruler drawing operation p_canvas = self.fitsimage.get_canvas() try: obj = p_canvas.getObjectByTag(self.layertag) except __HOLE__: # Add ruler layer p_canvas.add(self.canvas, tag=self.layertag) ...
KeyError
dataset/ETHPy150Open ejeschke/ginga/ginga/misc/plugins/Compose.py/Compose.start
@staticmethod def member_membership_paid(row): """ Whether the member has paid within 12 months of start_date anniversary @ToDo: Formula should come from the deployment_template """ T = current.T #try: # exempted = row["member_members...
AttributeError
dataset/ETHPy150Open sahana/eden/modules/s3db/member.py/S3MembersModel.member_membership_paid
def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'): """ Similar to smart_unicode, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects. """ # Handle the common case fi...
UnicodeDecodeError
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/encoding.py/force_unicode
def _get_wmi_setting(wmi_class_name, setting, server): ''' Get the value of the setting for the provided class. ''' with salt.utils.winapi.Com(): try: connection = wmi.WMI(namespace=_WMI_NAMESPACE) wmi_class = getattr(connection, wmi_class_name) objs = wmi_cl...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/_get_wmi_setting
def _set_wmi_setting(wmi_class_name, setting, value, server): ''' Set the value of the setting for the provided class. ''' with salt.utils.winapi.Com(): try: connection = wmi.WMI(namespace=_WMI_NAMESPACE) wmi_class = getattr(connection, wmi_class_name) objs =...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/_set_wmi_setting
def get_log_format_types(): ''' Get all available log format names and ids. :return: A dictionary of the log format names and ids. :rtype: dict CLI Example: .. code-block:: bash salt '*' win_smtp_server.get_log_format_types ''' ret = dict() prefix = 'logging/' with s...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/get_log_format_types
def get_servers(): ''' Get the SMTP virtual server names. :return: A list of the SMTP virtual servers. :rtype: list CLI Example: .. code-block:: bash salt '*' win_smtp_server.get_servers ''' ret = list() with salt.utils.winapi.Com(): try: connection =...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/get_servers
def get_server_setting(settings, server=_DEFAULT_SERVER): ''' Get the value of the setting for the SMTP virtual server. :param str settings: A list of the setting names. :param str server: The SMTP server name. :return: A dictionary of the provided settings and their values. :rtype: dict ...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/get_server_setting
def set_server_setting(settings, server=_DEFAULT_SERVER): ''' Set the value of the setting for the SMTP virtual server. .. note:: The setting names are case-sensitive. :param str settings: A dictionary of the setting names and their values. :param str server: The SMTP server name. :r...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/set_server_setting
def __getattr__(self, item): try: return self.dict[item] except __HOLE__: raise AttributeError("Missing user-supplied argument '%s' (set with: --arg %s=VALUE)" % (item, item))
KeyError
dataset/ETHPy150Open jlevy/ghizmo/ghizmo/main.py/UserArgs.__getattr__
def parse_tag_value(tag_list): """Parse a DKIM Tag=Value list. Interprets the syntax specified by RFC4871 section 3.2. Assumes that folding whitespace is already unfolded. @param tag_list: A string containing a DKIM Tag=Value list. """ tags = {} tag_specs = tag_list.strip().split(b';') ...
ValueError
dataset/ETHPy150Open Flolagale/mailin/python/dkim/util.py/parse_tag_value