Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
5,200
def test_set_font(self): rcmod.set(font="Verdana") _, ax = plt.subplots() ax.set_xlabel("foo") try: nt.assert_equal(ax.xaxis.label.get_fontname(), "Verdana") except __HOLE__: if has_verdana(): raise ...
AssertionError
dataset/ETHPy150Open mwaskom/seaborn/seaborn/tests/test_rcmod.py/TestFonts.test_set_font
5,201
def test_different_sans_serif(self): if LooseVersion(mpl.__version__) < LooseVersion("1.4"): raise nose.SkipTest rcmod.set() rcmod.set_style(rc={"font.sans-serif": ["Verdana"]}) _, ax = plt.subplots() ax.set_xlabel("foo") try: ...
AssertionError
dataset/ETHPy150Open mwaskom/seaborn/seaborn/tests/test_rcmod.py/TestFonts.test_different_sans_serif
5,202
def parse_host_args(self, *args): """ Splits out the patch subcommand and returns a comma separated list of host_strings """ self.subcommand = None new_args = args try: sub = args[0] if sub in ['project','templates','static','media','wsgi','webconf...
IndexError
dataset/ETHPy150Open bretth/woven/woven/management/commands/patch.py/Command.parse_host_args
5,203
def run(self): self.set_arguments() args = self.parser.parse_args() try: generate_json(args) except __HOLE__: pass
KeyboardInterrupt
dataset/ETHPy150Open projectatomic/atomic-reactor/atomic_reactor/cli/secret.py/CLI.run
5,204
def monkeypatch_pickle_builder(): import shutil from os import path try: import cPickle as pickle except __HOLE__: import pickle from sphinx.util.console import bold def handle_finish(self): # dump the global context outfilename = path.join(self.outdir, 'glob...
ImportError
dataset/ETHPy150Open dcramer/django-compositepks/docs/_ext/djangodocs.py/monkeypatch_pickle_builder
5,205
def execute(self, *args, **options): """ Try to execute this command, performing model validation if needed (as controlled by the attribute ``self.requires_model_validation``). If the command raises a ``CommandError``, intercept it and print it sensibly to stderr. ...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/management/base.py/BaseCommand.execute
5,206
def validate(self, app=None, display_num_errors=False): """ Validates the given app, raising CommandError for any errors. If app is None, then this will validate all installed apps. """ from django.core.management.validation import get_validation_errors try: ...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/management/base.py/BaseCommand.validate
5,207
def handle(self, *app_labels, **options): from django.db import models if not app_labels: raise CommandError('Enter at least one appname.') try: app_list = [models.get_app(app_label) for app_label in app_labels] except (ImproperlyConfigured, __HOLE__), e: ...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/management/base.py/AppCommand.handle
5,208
def copy_helper(style, app_or_project, name, directory, other_name=''): """ Copies either a Django application layout template or a Django project layout template into the specified directory. """ # style -- A color style object (see django.core.management.color). # app_or_project -- The string...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/management/base.py/copy_helper
5,209
def load_handler(path, *args, **kwargs): """ Given a path to a handler, return an instance of that handler. E.g.:: >>> load_handler('django.core.files.uploadhandler.TemporaryFileUploadHandler', request) <TemporaryFileUploadHandler object at 0x...> """ i = path.rfind('.') module...
ValueError
dataset/ETHPy150Open adieu/django-nonrel/django/core/files/uploadhandler.py/load_handler
5,210
def _getInstallFunction(platform): """ Return a function to install the reactor most suited for the given platform. @param platform: The platform for which to select a reactor. @type platform: L{twisted.python.runtime.Platform} @return: A zero-argument callable which will install the selected ...
ImportError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/default.py/_getInstallFunction
5,211
def __new__(cls, path): """Construct new EPath. """ if isinstance(path, EPath): return path if not path: raise ValueError("empty EPath") _path = path if path[0] == '/': path = path[1:] else: raise NotImplementedError("non...
ValueError
dataset/ETHPy150Open sympy/sympy/sympy/simplify/epathtools.py/EPath.__new__
5,212
def apply(self, expr, func, args=None, kwargs=None): """ Modify parts of an expression selected by a path. Examples ======== >>> from sympy.simplify.epathtools import EPath >>> from sympy import sin, cos, E >>> from sympy.abc import x, y, z, t >>> path ...
IndexError
dataset/ETHPy150Open sympy/sympy/sympy/simplify/epathtools.py/EPath.apply
5,213
def select(self, expr): """ Retrieve parts of an expression selected by a path. Examples ======== >>> from sympy.simplify.epathtools import EPath >>> from sympy import sin, cos, E >>> from sympy.abc import x, y, z, t >>> path = EPath("/*/[0]/Symbol") ...
IndexError
dataset/ETHPy150Open sympy/sympy/sympy/simplify/epathtools.py/EPath.select
5,214
@classmethod def from_entity(cls, entity): """Load from entity to class based on discriminator. Rather than instantiating a new Model instance based on the kind mapping, this creates an instance of the correct model class based on the entities class-key. Args: entity: Entity loaded directl...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/polymodel.py/PolyModel.from_entity
5,215
@csrf_exempt @RequireLogin(role='admin') def start(request): """ Start the proxy. """ if request.method != "GET": return HttpResponse(status=405) from api.models import redis_wrapper r = redis_wrapper.init_redis() response_key = str(ObjectId()) redis_wrapper.publish_to_proxy(jso...
ValueError
dataset/ETHPy150Open emccode/heliosburn/heliosburn/django/hbproject/api/views/proxy.py/start
5,216
@csrf_exempt @RequireLogin(role='admin') def stop(request): """ Stop the proxy. """ if request.method != "GET": return HttpResponse(status=405) from api.models import redis_wrapper r = redis_wrapper.init_redis() response_key = str(ObjectId()) redis_wrapper.publish_to_proxy(json....
ValueError
dataset/ETHPy150Open emccode/heliosburn/heliosburn/django/hbproject/api/views/proxy.py/stop
5,217
def query(self, query, timeout = None): try: return self.typeToMethod[query.type](str(query.name), timeout) except __HOLE__, e: return defer.fail(failure.Failure(NotImplementedError(str(self.__class__) + " " + str(query.type))))
KeyError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/names/common.py/ResolverBase.query
5,218
def build_extension(self, ext_name, configs = []): """Build extension by name, then return the module. The extension name may contain arguments as part of the string in the following format: "extname(key1=value1,key2=value2)" """ # Parse extensions config params (ignore the or...
ImportError
dataset/ETHPy150Open isnowfy/pydown/markdown/__init__.py/Markdown.build_extension
5,219
def set_output_format(self, format): """ Set the output format for the class instance. """ try: self.serializer = self.output_formats[format.lower()] except __HOLE__: raise KeyError('Invalid Output Format: "%s". Use one of %s.' \ % (format, ...
KeyError
dataset/ETHPy150Open isnowfy/pydown/markdown/__init__.py/Markdown.set_output_format
5,220
def convert(self, source): """ Convert markdown to serialized XHTML or HTML. Keyword arguments: * source: Source text as a Unicode string. Markdown processing takes place in five steps: 1. A bunch of "preprocessors" munge the input text. 2. BlockParser() parse...
ValueError
dataset/ETHPy150Open isnowfy/pydown/markdown/__init__.py/Markdown.convert
5,221
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) try: test_timeout = int(test_timeout) except __HOLE__: # If timeout value is invalid do no...
ValueError
dataset/ETHPy150Open openstack/ooi/ooi/tests/base.py/TestCase.setUp
5,222
@rbac(('owner', 'user')) def release(self, server): """ Shut-down :class:`ObjServer` `server`. server: :class:`ObjServer` Server to be shut down. """ try: address = server._token.address except __HOLE__: address = 'not-a-proxy' ...
AttributeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/ObjServerFactory.release
5,223
@rbac(('owner', 'user')) def create(self, typname, version=None, server=None, res_desc=None, **ctor_args): """ Create a new `typname` object in `server` or a new :class:`ObjectServer`. Returns a proxy for for the new object. Starts servers in a subdirectory of the cur...
AttributeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/ObjServerFactory.create
5,224
def __init__(self, name='', allow_shell=False, allowed_types=None): self._allow_shell = allow_shell if allowed_types is None: allowed_types = [typname for typname, version in get_available_types()] self._allowed_types = allowed_types sel...
ImportError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/ObjServer.__init__
5,225
@rbac('owner') def execute_command(self, resource_desc): """ Run command described by `resource_desc` in a subprocess if this server's `allow_shell` attribute is True. resource_desc: dict Contains job description. The current environment, along with any 'job_env...
KeyError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/ObjServer.execute_command
5,226
def connect(address, port, tunnel=False, authkey='PublicKey', pubkey=None, logfile=None): """ Connects to the server at `address` and `port` using `key` and returns a (shared) proxy for the associated :class:`ObjServerFactory`. address: string IP address for server or pipe filename....
KeyError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/connect
5,227
def main(): #pragma no cover """ OpenMDAO factory service process. Usage: python objserverfactory.py [--allow-public][--allow-shell][--hosts=filename][--types=filename][--users=filename][--address=address][--port=number][--prefix=name][--tunnel][--resources=filename][--log-host=hostname][--log-port=number...
IOError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/objserverfactory.py/main
5,228
def handle(self, *args, **options): try: xls_filepath = args[0] except __HOLE__: raise CommandError(_("You must provide the path to the xls file.")) # make sure path exists if not os.path.exists(xls_filepath): raise CommandError( _("The...
IndexError
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/logger/management/commands/publish_xls.py/Command.handle
5,229
def store_embedded_files(self, zfile): embedded_files = self.visitor.get_embedded_file_list() for source, destination in embedded_files: if source is None: continue try: # encode/decode destination1 = destination.decode('latin-1').e...
OSError
dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python3/docutils/writers/odf_odt/__init__.py/Writer.store_embedded_files
5,230
def get_image_width_height(self, node, attr): size = None if attr in node.attributes: size = node.attributes[attr] unit = size[-2:] if unit.isalpha(): size = size[:-2] else: unit = 'px' try: size ...
ValueError
dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python3/docutils/writers/odf_odt/__init__.py/ODFTranslator.get_image_width_height
5,231
def get_image_scale(self, node): if 'scale' in node.attributes: try: scale = int(node.attributes['scale']) if scale < 1: # or scale > 100: self.document.reporter.warning( 'scale out of range (%s), using 1.' % (scale, )) ...
ValueError
dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python3/docutils/writers/odf_odt/__init__.py/ODFTranslator.get_image_scale
5,232
def _create_site(): """Creates a site configured in settings.py.""" try: site = auth_models.SitesCollection().create_item( auth_models.SINGLE_SITE_ID) site.aliases.create_item(SITE_URL) return site except __HOLE__ as ex: raise ImproperlyConfigured('Failed to crea...
ValidationError
dataset/ETHPy150Open wrr/wwwhisper/wwwhisper_admin/__init__.py/_create_site
5,233
def _create_initial_locations(site): """Creates all locations listed in WWWHISPER_INITIAL_LOCATIONS setting.""" locations_paths = getattr(settings, 'WWWHISPER_INITIAL_LOCATIONS', []) for path in locations_paths: try: site.locations.create_item(path) except __HOLE__ as ex: ...
ValidationError
dataset/ETHPy150Open wrr/wwwhisper/wwwhisper_admin/__init__.py/_create_initial_locations
5,234
def _create_initial_admins(site): """Creates all users listed in WWWHISPER_INITIAL_ADMINS setting.""" emails = getattr(settings, 'WWWHISPER_INITIAL_ADMINS', []) for email in emails: try: user = site.users.create_item(email) except __HOLE__ as ex: raise ImproperlyConfi...
ValidationError
dataset/ETHPy150Open wrr/wwwhisper/wwwhisper_admin/__init__.py/_create_initial_admins
5,235
def add(self, name, auth_required=True, list_command=True, **validators): """Create a decorator that registers a handler and validation rules. Additional keyword arguments are treated as converters/validators to apply to tokens converting them to proper Python types. Requirements for v...
TypeError
dataset/ETHPy150Open mopidy/mopidy/mopidy/mpd/protocol/__init__.py/Commands.add
5,236
def collapse_addresses(addresses): """Collapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/collapse_addresses
5,237
@classmethod def _prefix_from_prefix_string(cls, prefixlen_str): """Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_IPAddressBase._prefix_from_prefix_string
5,238
@classmethod def _prefix_from_ip_string(cls, ip_str): """Turn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is no...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_IPAddressBase._prefix_from_ip_string
5,239
def __eq__(self, other): try: return (self._ip == other._ip and self._version == other._version) except __HOLE__: return NotImplemented
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_BaseAddress.__eq__
5,240
def __eq__(self, other): try: return (self._version == other._version and self.network_address == other.network_address and int(self.netmask) == int(other.netmask)) except __HOLE__: return NotImplemented
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_BaseNetwork.__eq__
5,241
@classmethod def _ip_int_from_string(cls, ip_str): """Turn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 A...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_BaseV4._ip_int_from_string
5,242
def _is_hostmask(self, ip_str): """Test if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. """ bits = ip_str.split('.') try: ...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_BaseV4._is_hostmask
5,243
def __eq__(self, other): address_equal = IPv4Address.__eq__(self, other) if not address_equal or address_equal is NotImplemented: return address_equal try: return self.network == other.network except __HOLE__: # An interface with an associated network ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/IPv4Interface.__eq__
5,244
def __lt__(self, other): address_less = IPv4Address.__lt__(self, other) if address_less is NotImplemented: return NotImplemented try: return self.network < other.network except __HOLE__: # We *do* allow addresses and interfaces to be sorted. The ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/IPv4Interface.__lt__
5,245
@classmethod def _ip_int_from_string(cls, ip_str): """Turn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. """ ...
ValueError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/_BaseV6._ip_int_from_string
5,246
def __eq__(self, other): address_equal = IPv6Address.__eq__(self, other) if not address_equal or address_equal is NotImplemented: return address_equal try: return self.network == other.network except __HOLE__: # An interface with an associated network ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/IPv6Interface.__eq__
5,247
def __lt__(self, other): address_less = IPv6Address.__lt__(self, other) if address_less is NotImplemented: return NotImplemented try: return self.network < other.network except __HOLE__: # We *do* allow addresses and interfaces to be sorted. The ...
AttributeError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/ipaddress.py/IPv6Interface.__lt__
5,248
def fileList(paths, relative=False, folders=False): """ Generate a recursive list of files from a given path. """ try: basestring except __HOLE__: # Python 3 basestring = unicode = str if isinstance(paths, basestring): paths = [paths] files = [] for pa...
NameError
dataset/ETHPy150Open randomknowledge/Cactus_Refactored/setup.py/fileList
5,249
def get_stop_words(language): try: stopwords_data = pkgutil.get_data("sumy", "data/stopwords/%s.txt" % language) except __HOLE__ as e: raise LookupError("Stop-words are not available for language %s." % language) return parse_stop_words(stopwords_data)
IOError
dataset/ETHPy150Open miso-belica/sumy/sumy/utils.py/get_stop_words
5,250
@classmethod def unserialize(cls, string, secret_key): """Load the secure cookie from a serialized string. :param string: the cookie value to unserialize. :param secret_key: the secret key used to serialize the cookie. :return: a new :class:`SecureCookie`. """ if isi...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/werkzeug/contrib/securecookie.py/SecureCookie.unserialize
5,251
def test_PacmanInstaller(): from rosdep2.platforms.arch import PacmanInstaller @patch.object(PacmanInstaller, 'get_packages_to_install') def test(mock_method): installer = PacmanInstaller() mock_method.return_value = [] assert [] == installer.get_install_command(['fake']) #...
AssertionError
dataset/ETHPy150Open ros-infrastructure/rosdep/test/test_rosdep_arch.py/test_PacmanInstaller
5,252
@ajax_request @login_required def set_password(request): """sets/updates a user's password, follows the min requiremnent of django-passwords settings in BE/settings/common.py :PUT: { 'current_password': current_password, 'password_1': password_1, 'password_2': password_2...
ValidationError
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/views/accounts.py/set_password
5,253
def start(ctrl): """Start the Helper controller either in the foreground or as a daemon process. :param ctrl helper.Controller: The controller class handle to create and run """ args = parser.parse() obj = ctrl(args, platform.operating_system()) if args.foreground: try: ...
KeyboardInterrupt
dataset/ETHPy150Open gmr/helper/helper/__init__.py/start
5,254
def _iterate_timeout(timeout, message, wait=2): """Iterate and raise an exception on timeout. This is a generator that will continually yield and sleep for wait seconds, and if the timeout is reached, will raise an exception with <message>. """ try: wait = float(wait) except __HOL...
ValueError
dataset/ETHPy150Open openstack-infra/shade/shade/_utils.py/_iterate_timeout
5,255
def safe_dict_min(key, data): """Safely find the minimum for a given key in a list of dict objects. This will find the minimum integer value for specific dictionary key across a list of dictionaries. The values for the given key MUST be integers, or string representations of an integer. The dictio...
ValueError
dataset/ETHPy150Open openstack-infra/shade/shade/_utils.py/safe_dict_min
5,256
def safe_dict_max(key, data): """Safely find the maximum for a given key in a list of dict objects. This will find the maximum integer value for specific dictionary key across a list of dictionaries. The values for the given key MUST be integers, or string representations of an integer. The dictio...
ValueError
dataset/ETHPy150Open openstack-infra/shade/shade/_utils.py/safe_dict_max
5,257
def low(data, queue=False, **kwargs): ''' Execute a single low data call This function is mostly intended for testing the state system and is not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": ...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/low
5,258
def high(data, test=False, queue=False, **kwargs): ''' Execute the compound calls stored in a single set of high data This function is mostly intended for testing the state system andis not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.high '...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/high
5,259
def template_str(tem, queue=False, **kwargs): ''' Execute the information stored in a string from an sls template CLI Example: .. code-block:: bash salt '*' state.template_str '<Template String>' ''' conflict = _check_queue(queue, kwargs) if conflict is not None: return co...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/template_str
5,260
def request(mods=None, **kwargs): ''' .. versionadded:: 2015.5.0 Request that the local admin execute a state run via `salt-call state.run_request` All arguments match state.apply CLI Example: .. code-block:: bash salt '*' state.request salt '*' state.request ...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/request
5,261
def clear_request(name=None): ''' .. versionadded:: 2015.5.0 Clear out the state execution request without executing it CLI Example: .. code-block:: bash salt '*' state.clear_request ''' notify_path = os.path.join(__opts__['cachedir'], 'req_state.p') serial = salt.payload.Ser...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/clear_request
5,262
def run_request(name='default', **kwargs): ''' .. versionadded:: 2015.5.0 Execute the pending state request CLI Example: .. code-block:: bash salt '*' state.run_request ''' req = check_request() if name not in req: return {} n_req = req[name] if 'mods' not in ...
IOError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/run_request
5,263
def highstate(test=None, queue=False, **kwargs): ''' Retrieve the state data from the salt master for this minion and execute it test Run states in test-only (dry-run) mode pillar Custom Pillar values, passed as a dictionary of key-value pairs .. co...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/highstate
5,264
def sls(mods, saltenv=None, test=None, exclude=None, queue=False, pillarenv=None, **kwargs): ''' Execute the states in one or more SLS files test Run states in test-only (dry-run) mode pillar Custom Pillar values, passed as a dictionary o...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/sls
5,265
def single(fun, name, test=None, queue=False, **kwargs): ''' Execute a single state function with the named kwargs, returns False if insufficient data is sent to the command By default, the values of the kwargs will be parsed as YAML. So, you can specify lists values, or lists of single entry key-v...
NameError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/single
5,266
def pkg(pkg_path, pkg_sum, hash_type, test=False, **kwargs): ''' Execute a packaged state run, the packaged state run will exist in a tarball available locally. This packaged state can be generated using salt-ssh. CLI Example: .. code-block:: bash salt '*' state.pkg /tmp/state_pkg.tgz...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/pkg
5,267
def gracefulrestart (tokeniser, default): if len(tokeniser.tokens) == 1: return default state = string(tokeniser) if state in ('disable','disabled'): return False try: grace = int(state) except __HOLE__: raise ValueError('"%s" is an invalid graceful-restart time' % state) if grace < 0: raise ValueEr...
ValueError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/configuration/capability.py/gracefulrestart
5,268
def get_cpu_style(): global _CPU_STYLE if _CPU_STYLE is None: vbs_file = 'get_cpu_style.vbs' vbs_path = path.join(LOCAL_DIR, vbs_file) popen = sp.Popen('cscript /nologo %s'%vbs_path, stdout=sp.PIPE, shell=True) popen.wait() result = popen.stdout.read() cpu_style =...
UnicodeDecodeError
dataset/ETHPy150Open everydo/ztq/ztq_worker/ztq_worker/system_info/win.py/get_cpu_style
5,269
def run(self): try: while True: try: line = raw_input(self.PROMPT) line = line.strip() if line: self.process_command_line(line) self.last_command = line eli...
KeyboardInterrupt
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/tools/pyocd.py/PyOCDConsole.run
5,270
def process_command(self, cmd): try: args = cmd.split() cmd = args[0].lower() args = args[1:] # Handle help. if cmd in ['?', 'help']: self.show_help(args) return # Handle register name as command. ...
ValueError
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/tools/pyocd.py/PyOCDConsole.process_command
5,271
def run(self): try: # Read command-line arguments. self.args = self.get_args() self.cmd = self.args.cmd if self.cmd: self.cmd = self.cmd.lower() # Set logging level self.configure_logging() # Check for a valid ...
ValueError
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/tools/pyocd.py/PyOCDTool.run
5,272
def require_pkgresources(name): try: import pkg_resources except __HOLE__: raise RuntimeError("'{0}' needs pkg_resources (part of setuptools).".format(name))
ImportError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/wheel/tool/__init__.py/require_pkgresources
5,273
def get_keyring(): try: from ..signatures import keys import keyring except __HOLE__: raise WheelError("Install wheel[signatures] (requires keyring, pyxdg) for signatures.") return keys.WheelKeys, keyring
ImportError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/wheel/tool/__init__.py/get_keyring
5,274
def install_scripts(distributions): """ Regenerate the entry_points console_scripts for the named distribution. """ try: from setuptools.command import easy_install import pkg_resources except __HOLE__: raise RuntimeError("'wheel install_scripts' needs setuptools.") for ...
ImportError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/wheel/tool/__init__.py/install_scripts
5,275
def aget(dct, key): r"""Allow to get values deep in a dict with iterable keys Accessing leaf values is quite straightforward: >>> dct = {'a': {'x': 1, 'b': {'c': 2}}} >>> aget(dct, ('a', 'x')) 1 >>> aget(dct, ('a', 'b', 'c')) 2 If key is empty, it returns unchanged...
StopIteration
dataset/ETHPy150Open 0k/shyaml/shyaml.py/aget
5,276
def oauth_callback(request, service): local_host = utils.get_local_host(request) form = forms.OAuth2CallbackForm(service=service, local_host=local_host, data=request.GET) if form.is_valid(): try: user = form.get_authenticated_user() except __HO...
ValueError
dataset/ETHPy150Open mirumee/saleor/saleor/registration/views.py/oauth_callback
5,277
def get_max_age(response): """ Returns the max-age from the response Cache-Control header as an integer (or ``None`` if it wasn't found or wasn't an integer. """ if not response.has_header('Cache-Control'): return cc = dict(_to_tuple(el) for el in cc_delim_re.split(response['Cache-Contro...
ValueError
dataset/ETHPy150Open django/django/django/utils/cache.py/get_max_age
5,278
def get_conditional_response(request, etag=None, last_modified=None, response=None): # Get HTTP request headers if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: if_modified_since = parse_http_date_safe(if_modified_since) if_unmodified_since = request.META.get(...
ValueError
dataset/ETHPy150Open django/django/django/utils/cache.py/get_conditional_response
5,279
def wrap_exceptions(fun): def wrapper(self, *args, **kwargs): try: return fun(self, *args, **kwargs) except __HOLE__ as err: from psutil._pswindows import ACCESS_DENIED_SET if err.errno in ACCESS_DENIED_SET: raise psutil.AccessDenied(None, None) ...
OSError
dataset/ETHPy150Open giampaolo/psutil/psutil/tests/test_windows.py/wrap_exceptions
5,280
@unittest.skipIf(wmi is None, "wmi module is not installed") @retry_before_failing() def test_disks(self): ps_parts = psutil.disk_partitions(all=True) wmi_parts = wmi.WMI().Win32_LogicalDisk() for ps_part in ps_parts: for wmi_part in wmi_parts: if ps_part.devi...
OSError
dataset/ETHPy150Open giampaolo/psutil/psutil/tests/test_windows.py/WindowsSpecificTestCase.test_disks
5,281
def test_compare_values(self): def assert_ge_0(obj): if isinstance(obj, tuple): for value in obj: self.assertGreaterEqual(value, 0, msg=obj) elif isinstance(obj, (int, long, float)): self.assertGreaterEqual(obj, 0) else: ...
AssertionError
dataset/ETHPy150Open giampaolo/psutil/psutil/tests/test_windows.py/TestDualProcessImplementation.test_compare_values
5,282
def KeyHasExpired(key): """Check to see whether an SSH key has expired. Uses Google-specific (for now) semantics of the OpenSSH public key format's comment field to determine if an SSH key is past its expiration timestamp, and therefore no longer to be trusted. This format is still subject to change. Relianc...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/compute-image-packages/google-daemon/usr/share/google/google_daemon/desired_accounts.py/KeyHasExpired
5,283
def GetDesiredAccounts(self): """Get a list of the accounts desired on the system. Returns: A dict of the form: {'username': ['sshkey1, 'sshkey2', ...]}. """ logging.debug('Getting desired accounts from metadata.') # Fetch the top level attribute with a hanging get. metadata_content = sel...
KeyError
dataset/ETHPy150Open GoogleCloudPlatform/compute-image-packages/google-daemon/usr/share/google/google_daemon/desired_accounts.py/DesiredAccounts.GetDesiredAccounts
5,284
def get(self, item, default=None): try: return self.__getitem__(item) except __HOLE__: return default
KeyError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/system.py/WorkspaceEntryDict.get
5,285
def pop(self, *args): if len(args) > 2: raise TypeError, 'pop expected at most 2 arguments, got %d' % len(args) elif len(args) < 1: raise TypeError, 'pop expected at least 1 arguments, got %d' % len(args) if args[0] not in self.keys(): try: re...
IndexError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/system.py/FileInfo.pop
5,286
def __init__(self, pathOrRefNode=None, namespace=None, refnode=None): import general, nodetypes self._refNode = None if pathOrRefNode: if isinstance(pathOrRefNode, (basestring,Path)): try: self._refNode = general.PyNode( cmds.referenceQuery( str(pa...
RuntimeError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/system.py/FileReference.__init__
5,287
def run(self): try: Arbiter(self).run() except __HOLE__ as e: print("\nError: %s\n" % e, file=sys.stderr) sys.stderr.flush() sys.exit(1)
RuntimeError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/gunicorn/app/base.py/BaseApplication.run
5,288
def load_config_from_module_name_or_filename(self, location): """ Loads the configuration file: the file is a python file, otherwise raise an RuntimeError Exception or stop the process if the configuration file contains a syntax error. """ try: cfg = self.get_config_...
ImportError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/gunicorn/app/base.py/Application.load_config_from_module_name_or_filename
5,289
def _get_stream_info_from_value(self, result, name): r_dict = {} if 'value' in result: value = result['value'] try: value_dict = json.loads(value) except (__HOLE__, TypeError): return Failure(InvalidStreamInfoError(name)) kn...
ValueError
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/LBRYcrdWallet.py/LBRYWallet._get_stream_info_from_value
5,290
def _get_status_of_claim(self, txid, name, sd_hash): d = self.get_claims_from_tx(txid) def get_status(claims): if claims is None: claims = [] for claim in claims: if 'in claim trie' in claim: if 'name' in claim and str(claim['n...
ValueError
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/LBRYcrdWallet.py/LBRYWallet._get_status_of_claim
5,291
def _check_expected_balances(self): now = datetime.datetime.now() balances_to_check = [] try: while self.expected_balance_at_time[0][3] < now: balances_to_check.append(self.expected_balance_at_time.popleft()) except __HOLE__: pass ds = [] ...
IndexError
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/LBRYcrdWallet.py/LBRYWallet._check_expected_balances
5,292
def _start_daemon(self): tries = 0 try: rpc_conn = self._get_rpc_conn() rpc_conn.getinfo() log.info("lbrycrdd was already running when LBRYcrdWallet was started.") return except (socket.error, JSONRPCException): tries += 1 ...
OSError
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/LBRYcrdWallet.py/LBRYcrdWallet._start_daemon
5,293
def exists(path): # Figure out what (if any) part of the path is a zip archive. archive_path, file_path = split_zip_path(path) # If the user is not trying to check a zip file, just use os.path... if not archive_path: return os.path.exists(path) # otherwise check the zip file. with clos...
KeyError
dataset/ETHPy150Open brownhead/superzippy/superzippy/bootstrapper/zipsite.py/exists
5,294
def GetCompilerType(env): try: sysenv = environ.copy() sysenv['PATH'] = str(env['ENV']['PATH']) result = exec_command([env.subst("$CC"), "-v"], env=sysenv) except __HOLE__: return None if result['returncode'] != 0: return None output = "".join([result['out'], resu...
OSError
dataset/ETHPy150Open platformio/platformio/platformio/builder/tools/piomisc.py/GetCompilerType
5,295
def read_sensor(): try: # pressure=pressure = bmp.readPressure()/100.0 light=grovepi.analogRead(light_sensor) [temp,humidity] = grovepi.dht(temp_humidity_sensor,therm_version) # Here we're using the thermometer version. #Return -1 in case of bad temp/humidity sensor reading if math.isnan(temp) or math.isnan(...
IOError
dataset/ETHPy150Open DexterInd/GrovePi/Projects/weather_station/weather_station-White_Temp_Sensor.py/read_sensor
5,296
@classmethod def flatten(cls, args): # quick-n-dirty flattening for And and Or args_queue = list(args) res = [] while True: try: arg = args_queue.pop(0) except __HOLE__: break if isinstance(arg, Logic): ...
IndexError
dataset/ETHPy150Open sympy/sympy/sympy/core/logic.py/AndOr_Base.flatten
5,297
def save_session(self, session_name): if not serialize.is_valid(session_name): error_message("invalid_name", session_name) self.run() return session = Session.save(session_name, sublime.windows()) try: serialize.dump(session_name, session)...
OSError
dataset/ETHPy150Open Zeeker/sublime-SessionManager/SessionManager.py/SaveSession.save_session
5,298
def handle_session(self, session_name): try: session = serialize.load(session_name) except __HOLE__ as e: error_message(e.errno) else: session.load()
OSError
dataset/ETHPy150Open Zeeker/sublime-SessionManager/SessionManager.py/LoadSession.handle_session
5,299
def handle_session(self, session_name): try: serialize.delete(session_name) except __HOLE__ as e: error_message(e.errno) else: sublime.status_message(messages.message("deleted", session_name))
OSError
dataset/ETHPy150Open Zeeker/sublime-SessionManager/SessionManager.py/DeleteSession.handle_session