Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
2,900
def main(): """ The entry point for the script. This script is fairly basic. Here is a quick example of how to use it:: django_test_runner.py [path-to-app] You must have Django on the PYTHONPATH prior to running this script. This script basically will bootstrap a Django environment for you. By default this s...
IndexError
dataset/ETHPy150Open ericholscher/django-test-utils/test_utils/bin/django_test_runner.py/main
2,901
def get_docker_client(): """ Try to fire up boot2docker and set any environmental variables """ # For Mac try: # Get boot2docker info (will fail if not Mac) process = ['boot2docker', 'info'] p = subprocess.Popen(process, stdout=PIPE) boot2docker_info = json.loads(p.co...
OSError
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/get_docker_client
2,902
def stop_boot2docker(): """ Shut down boot2docker if applicable """ try: process = ['boot2docker', 'stop'] subprocess.call(process) print('Boot2Docker VM Stopped') except __HOLE__: pass except: raise
OSError
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/stop_boot2docker
2,903
def start_docker_containers(docker_client, container=None): """ Start Docker containers """ # Perform check container_check(docker_client, container=container) # Get container dicts container_status = get_docker_container_status(docker_client) # Start PostGIS try: if not co...
KeyError
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/start_docker_containers
2,904
def stop_docker_containers(docker_client, silent=False, container=None): """ Stop Docker containers """ # Perform check container_check(docker_client, container=container) # Get container dicts container_status = get_docker_container_status(docker_client) # Stop PostGIS try: ...
KeyError
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/stop_docker_containers
2,905
def docker_ip(): """ Returns the hosts and ports of the Docker containers. """ # Retrieve a Docker client docker_client = get_docker_client() # Containers containers = get_docker_container_dicts(docker_client) container_status = get_docker_container_status(docker_client) docker_host...
KeyError
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/docker_ip
2,906
def init_from_registered_applications(self, request): created_items = [] for backend in CostTrackingRegister.get_registered_backends(): try: items = backend.get_default_price_list_items() except __HOLE__: continue with transaction.atomi...
NotImplementedError
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/cost_tracking/admin.py/DefaultPriceListItemAdmin.init_from_registered_applications
2,907
def _get_patch(self, request, *args, **kwargs): try: review_request = \ resources.review_request.get_object(request, *args, **kwargs) diffset = self.get_object(request, *args, **kwargs) except __HOLE__: return DOES_NOT_EXIST tool = review_requ...
ObjectDoesNotExist
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/webapi/resources/diff.py/DiffResource._get_patch
2,908
@webapi_login_required @webapi_check_local_site @webapi_response_errors(DOES_NOT_EXIST, NOT_LOGGED_IN, PERMISSION_DENIED) @webapi_request_fields( allow_unknown=True ) def update(self, request, extra_fields={}, *args, **kwargs): """Updates a diff. This is used solely for upda...
ObjectDoesNotExist
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/webapi/resources/diff.py/DiffResource.update
2,909
def wal_archive(self, wal_path, concurrency=1): """ Uploads a WAL file to S3 or Windows Azure Blob Service This code is intended to typically be called from Postgres's archive_command feature. """ # Upload the segment expressly indicated. It's special # relativ...
StopIteration
dataset/ETHPy150Open wal-e/wal-e/wal_e/operator/backup.py/Backup.wal_archive
2,910
def test_get_language_title(self): """Test get_language_title utility function""" language_code = 'en' self.assertEqual(get_language_title(language_code), 'English') # Test the case where requested language is not in settings. # We can not override settings, since languages in g...
KeyError
dataset/ETHPy150Open edoburu/django-parler/parler/tests/test_utils.py/UtilTestCase.test_get_language_title
2,911
@login_required def callback(request): """ Step 2 of OAuth: fetch the token. """ try: oauth_state = request.session['oauth_state'] except __HOLE__: return HttpResponseBadRequest('Missing oauth state.') github = OAuth2Session(settings.GITHUB_CLIENT_ID, state=oauth_state) toke...
KeyError
dataset/ETHPy150Open m-vdb/github-buildservice-boilerplate/buildservice/views/oauth.py/callback
2,912
def load(self, fname, iszip=True): if sys.version_info[0] == 3: fname = fname + '.3' if not iszip: d = marshal.load(open(fname, 'rb')) else: try: f = gzip.open(fname, 'rb') d = marshal.loads(f.read()) except __HOLE__...
IOError
dataset/ETHPy150Open isnowfy/snownlp/snownlp/utils/tnt.py/TnT.load
2,913
def test_correct_json_validation(self): """Tests that when a JSON snippet is incorrect, an error must be raised. """ try: validate_json('{"id":1,"name":"foo","interest":["django","django ERP"]}') self.assertTrue(True) except __HOLE__: self.assertFalse(True)
ValidationError
dataset/ETHPy150Open django-erp/django-erp/djangoerp/core/tests.py/JSONValidationCase.test_correct_json_validation
2,914
def test_incorrect_json_validation(self): """Tests that when a JSON snippet is incorrect, an error must be raised. """ try: # The snippet is incorrect due to the double closed square bracket. validate_json('{"id":1,"name":"foo","interest":["django","django ERP"]]}') ...
ValidationError
dataset/ETHPy150Open django-erp/django-erp/djangoerp/core/tests.py/JSONValidationCase.test_incorrect_json_validation
2,915
def getNumLines(self, fileName): try: reader = csv.reader(open(fileName, "rU")) except __HOLE__: raise numLines = 0 for row in reader: numLines = numLines + 1 return numLines
IOError
dataset/ETHPy150Open charanpald/APGL/apgl/io/CsvReader.py/CsvReader.getNumLines
2,916
def test_using_keyword(self): self.assert_count(self.model, 0) self.assert_count(self.model, 0, using='legacy') self.assert_create(self.model, using='legacy', **self.kwargs) self.assert_count(self.model, 0) self.assert_not_count(self.model, 0, using='legacy') self.asser...
AssertionError
dataset/ETHPy150Open playpauseandstop/tddspry/tests/testproject/multidb/tests/test_models.py/TestModels.test_using_keyword
2,917
def versions_from_vcs(tag_prefix, versionfile_source, verbose=False): # this runs 'git' from the root of the source tree. That either means # someone ran a setup.py command (and this code is in versioneer.py, so # IN_LONG_VERSION_PY=False, thus the containing directory is the root of # the source tree),...
NameError
dataset/ETHPy150Open bokeh/bokeh/bokeh/_version.py/versions_from_vcs
2,918
def versions_from_parentdir(parentdir_prefix, versionfile_source, verbose=False): if IN_LONG_VERSION_PY: # We're running from _version.py. If it's from a source tree # (execute-in-place), we can work upwards to find the root of the # tree, and then check the parent directory for a version st...
NameError
dataset/ETHPy150Open bokeh/bokeh/bokeh/_version.py/versions_from_parentdir
2,919
def main(argv): logging.config.fileConfig(open("logging.ini")) path = argv[0] files_start = getfiles(path) time.sleep(0.1) files_end = getfiles(path) # Find the files which haven't changed size. unchanged = {} for filename, start_size in files_start.iteritems(): try: end_size = files_end[fil...
KeyError
dataset/ETHPy150Open timvideos/streaming-system/tools/youtube/putvideo.py/main
2,920
def evaluate(node, sphinxContext, value=False, fallback=None, hsBoundFact=False): if isinstance(node, astNode): if fallback is None: result = evaluator[node.__class__.__name__](node, sphinxContext) else: try: result = evaluator[node.__class__.__name__](node, s...
StopIteration
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluate
2,921
def evaluateBinaryOperation(node, sphinxContext): leftValue = evaluate(node.leftExpr, sphinxContext, value=True, fallback=UNBOUND) rightValue = evaluate(node.rightExpr, sphinxContext, value=True, fallback=UNBOUND) op = node.op if sphinxContext.formulaOptions.traceVariableExpressionEvaluation: sp...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateBinaryOperation
2,922
def evaluateFunctionDeclaration(node, sphinxContext, args): overriddenVariables = {} if isinstance(args, dict): # args may not all be used in the function declaration, just want used ones argDict = dict((name, value) for name, value in args.items() ...
StopIteration
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateFunctionDeclaration
2,923
def evaluateAggregateFunction(node, sphinxContext, name): # determine if evaluating args found hyperspace (first time) args = [] iterateAbove, bindingsLen = getattr(node, "aggregationHsBindings", (None, None)) firstTime = bindingsLen is None hsBindings = sphinxContext.hyperspaceBindings parentAg...
TypeError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateAggregateFunction
2,924
def evaluateTagReference(node, sphinxContext): try: return sphinxContext.tags[node.name] except __HOLE__: raise SphinxException(node, "sphinx:tagName", _("unassigned tag name %(name)s"), name=node.name )
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateTagReference
2,925
def evaluateRule(node, sphinxContext): isFormulaRule = isinstance(node, astFormulaRule) isReportRule = isinstance(node, astReportRule) name = (node.name or ("sphinx.report" if isReportRule else "sphinx.raise")) nodeId = node.nodeTypeName + ' ' + name if node.precondition: result = evaluate(n...
StopIteration
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateRule
2,926
def evaluateUnaryOperation(node, sphinxContext): if node.op == "brackets": # parentheses around an expression return node.expr value = evaluate(node.expr, sphinxContext, value=True, fallback=UNBOUND) if value is UNBOUND: return UNBOUND try: result = {'+': operator.pos, '-': oper...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateUnaryOperation
2,927
def evaluateVariableReference(node, sphinxContext): try: return sphinxContext.localVariables[node.variableName] except __HOLE__: if node.variableName in sphinxContext.constants: return evaluateConstant(sphinxContext.constants[node.variableName], sphinxContext) raise SphinxExc...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxEvaluator.py/evaluateVariableReference
2,928
def RenderBranch(self, path, request): """Renders tree leafs for filesystem path.""" aff4_root = rdfvalue.RDFURN(request.REQ.get("aff4_root", self.root_path)) urn = aff4_root.Add(path) try: directory = aff4.FACTORY.Create(urn, "VFSDirectory", mode="r", token=r...
IOError
dataset/ETHPy150Open google/grr/grr/gui/plugins/configuration_view.py/ConfigurationTree.RenderBranch
2,929
def close(self): """Closes all files. If you put real :class:`file` objects into the :attr:`files` dict you can call this method to automatically close them all in one go. """ if self.closed: return try: files = itervalues(self.files) exce...
AttributeError
dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/test.py/EnvironBuilder.close
2,930
def error(self, obj, name, value): """Returns a descriptive error string.""" # pylint: disable=E1101 if self.low is None and self.high is None: if self.units: info = "a float having units compatible with '%s'" % self.units else: info = "a ...
AttributeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/datatypes/float.py/Float.error
2,931
def _validate_with_metadata(self, obj, name, value, src_units): """Perform validation and unit conversion using metadata from the source trait. """ # pylint: disable=E1101 dst_units = self.units if isinstance(value, UncertainDistribution): value = value.getv...
NameError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/datatypes/float.py/Float._validate_with_metadata
2,932
def get_parent(self): """ Get the parent model. Returns None if current element is the root element. """ if self.parent_id: for model in CascadeModelBase._get_cascade_elements(): try: return model.objects.get(id=self.parent_id) ...
ObjectDoesNotExist
dataset/ETHPy150Open jrief/djangocms-cascade/cmsplugin_cascade/models_base.py/CascadeModelBase.get_parent
2,933
@register.render_tag def page_menu(context, token): """ Return a list of child pages for the given parent, storing all pages in a dict in the context when first called using parents as keys for retrieval on subsequent recursive calls from the menu template. """ # First arg could be the menu temp...
KeyError
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/templatetags/pages_tags.py/page_menu
2,934
@register.render_tag def set_page_permissions(context, token): """ Assigns a permissions dict to the given page instance, combining Django's permission for the page's model and a permission check against the instance itself calling the page's ``can_add``, ``can_change`` and ``can_delete`` custom met...
AttributeError
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/templatetags/pages_tags.py/set_page_permissions
2,935
def wikipedia_url_parse(url): seed_page = "https://en.wikipedia.org" #Crawling the English Wikipedia try: from urllib.parse import urlparse except __HOLE__: from urlparse import urlparse url = url #.lower() #Make it lower case s = urlparse(url) #parse the given url see...
ImportError
dataset/ETHPy150Open hardikvasa/webb/webb/webb.py/wikipedia_url_parse
2,936
def get_product_price_gross(self, request): """ Returns the product item price. Based on selected properties, etc. """ if not self.product.is_configurable_product(): price = self.product.get_price_gross(request, amount=self.amount) else: if self.product.ac...
TypeError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/cart/models.py/CartItem.get_product_price_gross
2,937
def get_properties(self): """ Returns properties of the cart item. Resolves option names for select fields. """ properties = [] for prop_dict in self.product.get_properties(): prop = prop_dict['property'] property_group = prop_dict['property_group'...
ValueError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/cart/models.py/CartItem.get_properties
2,938
def stub_if_missing_deps(*deps): """A class decorator that will try to import the specified modules and in the event of failure will stub out the class, raising a RuntimeError that explains the missing dependencies whenever an attempt is made to instantiate the class. deps: str args arg...
ImportError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.util/src/openmdao/util/decorators.py/stub_if_missing_deps
2,939
def test_sequential_flow_interrupted_externally(self): flow = lf.Flow('flow-1').add( utils.ProgressingTask(name='task1'), utils.ProgressingTask(name='task2'), utils.ProgressingTask(name='task3'), ) engine = self._make_engine(flow) def _run_engine_and_...
StopIteration
dataset/ETHPy150Open openstack/taskflow/taskflow/tests/unit/test_engines.py/EngineLinearFlowTest.test_sequential_flow_interrupted_externally
2,940
def test_sequential_flow_iter_suspend_resume(self): flow = lf.Flow('flow-2').add( utils.ProgressingTask(name='task1'), utils.ProgressingTask(name='task2') ) lb, fd = p_utils.temporary_flow_detail(self.backend) engine = self._make_engine(flow, flow_detail=fd) ...
StopIteration
dataset/ETHPy150Open openstack/taskflow/taskflow/tests/unit/test_engines.py/EngineLinearFlowTest.test_sequential_flow_iter_suspend_resume
2,941
def __init__(self, *args, **kwargs): super(ListResource, self).__init__(*args, **kwargs) try: self.key except __HOLE__: self.key = self.name.lower()
AttributeError
dataset/ETHPy150Open awslabs/lambda-apigateway-twilio-tutorial/twilio/rest/resources/base.py/ListResource.__init__
2,942
def main(): args = parser.parse_args() # Generate Heroku app name. app_name = args.app or args.project_name.replace("_", "-") # Create the project. try: os.makedirs(args.dest_dir) except __HOLE__: pass management.call_command("startproject", args.project_name, ...
OSError
dataset/ETHPy150Open etianen/django-herokuapp/herokuapp/bin/herokuapp_startproject.py/main
2,943
def _authenticate_keystone(self): if self.user_id: creds = {'userId': self.user_id, 'password': self.password} else: creds = {'username': self.username, 'password': self.password} if self.tenant_id: body = {'auth': {'...
ValueError
dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/client.py/HTTPClient._authenticate_keystone
2,944
def request(self, *args, **kwargs): kwargs.setdefault('authenticated', False) kwargs.setdefault('raise_exc', False) content_type = kwargs.pop('content_type', None) or 'application/json' headers = kwargs.setdefault('headers', {}) headers.setdefault('Accept', content_type) ...
KeyError
dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/client.py/SessionClient.request
2,945
def get_auth_info(self): auth_info = {'auth_token': self.auth_token, 'endpoint_url': self.endpoint_url} # NOTE(jamielennox): This is the best we can do here. It will work # with identity plugins which is the primary case but we should # deprecate it's usage as much ...
AttributeError
dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/client.py/SessionClient.get_auth_info
2,946
def get_review_request(self): """Return the ReviewRequest that this file is attached to.""" if hasattr(self, '_review_request'): return self._review_request try: return self.review_request.all()[0] except IndexError: try: return self.i...
IndexError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/attachments/models.py/FileAttachment.get_review_request
2,947
def cleanse_setting(key, value): """Cleanse an individual setting key/value of sensitive content. If the value is a dictionary, recursively cleanse the keys in that dictionary. """ try: if HIDDEN_SETTINGS.search(key): cleansed = '********************' else: i...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/views/debug.py/cleanse_setting
2,948
def get_traceback_html(self): "Return HTML code for traceback." if issubclass(self.exc_type, TemplateDoesNotExist): from django.template.loader import template_source_loaders self.template_does_not_exist = True self.loader_debug_info = [] for loader in te...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/views/debug.py/ExceptionReporter.get_traceback_html
2,949
def _get_lines_from_file(self, filename, lineno, context_lines, loader=None, module_name=None): """ Returns context_lines before and after lineno from file. Returns (pre_context_lineno, pre_context, context_line, post_context). """ source = None if loader is not None and ...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/views/debug.py/ExceptionReporter._get_lines_from_file
2,950
def technical_404_response(request, exception): "Create a technical 404 error response. The exception should be the Http404." try: tried = exception.args[0]['tried'] except (IndexError, __HOLE__, KeyError): tried = [] else: if not tried: # tried exists but is an empty...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/views/debug.py/technical_404_response
2,951
def _add_thread_exception(self, thread): """Create a StreamRuntimeError exception object and fill attributes with all necessary values. """ node = thread.node exception = StreamRuntimeError(node=node, exception=thread.exception) exception.traceback = thread.traceback ...
AttributeError
dataset/ETHPy150Open Stiivi/brewery/brewery/streams.py/Stream._add_thread_exception
2,952
def handle(self, *args, **options): super(Command, self).handle(*args, **options) """ Connect to Github using token stored in environment, loop over model fields, and \ create an issue for any choice field missing """ self.dry_run = options["dry_run"] # set up co...
KeyError
dataset/ETHPy150Open california-civic-data-coalition/django-calaccess-raw-data/example/toolbox/management/commands/createverboseandhelptextissues.py/Command.handle
2,953
def get_text_object_region(view, s, text_object, inclusive=False, count=1): try: delims, type_ = PAIRS[text_object] except __HOLE__: return s if type_ == TAG: begin_tag, end_tag, _ = find_containing_tag(view, s.b) if inclusive: return sublime.Region(begin_tag.a, ...
KeyError
dataset/ETHPy150Open guillermooo/Vintageous/vi/text_objects.py/get_text_object_region
2,954
def get_sha1_params_url(path_info): """Returns the sha1 of requested page and params app. """ # if settings.DEBUG: # print "## get_sha1_params_url() :" slug = '' params = '' params_admin = '/' index = 0 separator = False error = False admin = False # We delete the ...
ValueError
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/website/utils.py/get_sha1_params_url
2,955
def _resolve_request(self, url_path, format): # custom provider if self.application.custom_provider is not None: response = self.application.custom_provider(self.request) if response is not None: return self._write_response(response) # get request data ...
ValueError
dataset/ETHPy150Open tomashanacek/mock-server/mock_server/handlers.py/MainHandler._resolve_request
2,956
def _skip_row(self, row): if row == []: return True if row[0] == 'Total': return True if row[0] == 'Official Totals': return True if isinstance(row[0], float): return False if row[0].strip() == '': return True if...
IndexError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wy/load.py/WYLoader._skip_row
2,957
def _votes(self, val): """ Returns cleaned version of votes or 0 if it's a non-numeric value. """ try: return int(float(val)) except __HOLE__: # Count'y convert value from string return None
ValueError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wy/load.py/WYLoader._votes
2,958
def _writein(self, row): # sometimes write-in field not present try: write_in = row['Write-In?'].strip() except __HOLE__: write_in = None return write_in
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wy/load.py/WYLoader._writein
2,959
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Search the environment for the relative path ''' fnd = {'path': '', 'rel': ''} if os.path.isabs(path): return fnd if tgt_env not in envs(): return fnd if os.path.basename(path) == 'top.sls': l...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/fileserver/minionfs.py/find_file
2,960
def file_hash(load, fnd): ''' Return a file hash, the hash type is set in the master config file ''' path = fnd['path'] ret = {} if 'env' in load: salt.utils.warn_until( 'Oxygen', 'Parameter \'env\' has been detected in the argument list. This ' 'par...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/fileserver/minionfs.py/file_hash
2,961
@staticmethod def get_pyaudio(): """ Imports the pyaudio module and checks its version. Throws exceptions if pyaudio can't be found or a wrong version is installed """ try: import pyaudio except __HOLE__: raise AttributeError("Could not find PyAudio; c...
ImportError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Microphone.get_pyaudio
2,962
def recognize_sphinx(self, audio_data, language = "en-US", show_all = False): """ Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using CMU Sphinx. The recognition language is determined by ``language``, an RFC5646 language tag like ``"en-US"`` or ``"en-GB"``, default...
ImportError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_sphinx
2,963
def recognize_google(self, audio_data, key = None, language = "en-US", show_all = False): """ Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the Google Speech Recognition API. The Google Speech Recognition API key is specified by ``key``. If not specified, it u...
HTTPError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_google
2,964
def recognize_wit(self, audio_data, key, show_all = False): """ Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the Wit.ai API. The Wit.ai API key is specified by ``key``. Unfortunately, these are not available without `signing up for an account <https://wit.ai/...
HTTPError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_wit
2,965
def recognize_bing(self, audio_data, key, language = "en-US", show_all = False): """ Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the Microsoft Bing Voice Recognition API. The Microsoft Bing Voice Recognition API key is specified by ``key``. Unfortunately, th...
ImportError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_bing
2,966
def recognize_api(self, audio_data, client_access_token, language = "en", show_all = False): """ Perform speech recognition on ``audio_data`` (an ``AudioData`` instance), using the api.ai Speech to Text API. The api.ai API client access token is specified by ``client_access_token``. Unfortunate...
HTTPError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_api
2,967
def recognize_ibm(self, audio_data, username, password, language = "en-US", show_all = False): """ Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the IBM Speech to Text API. The IBM Speech to Text username and password are specified by ``username`` and ``passwo...
HTTPError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/Recognizer.recognize_ibm
2,968
def get_flac_converter(): # determine which converter executable to use system = platform.system() path = os.path.dirname(os.path.abspath(__file__)) # directory of the current module file, where all the FLAC bundled binaries are stored flac_converter = shutil_which("flac") # check for installed version ...
OSError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/get_flac_converter
2,969
def recognize_att(self, audio_data, app_key, app_secret, language = "en-US", show_all = False): authorization_url = "https://api.att.com/oauth/v4/token" authorization_body = "client_id={0}&client_secret={1}&grant_type=client_credentials&scope=SPEECH".format(app_key, app_secret) try: authorization_response =...
HTTPError
dataset/ETHPy150Open Uberi/speech_recognition/speech_recognition/__init__.py/recognize_att
2,970
def test_ovs_restart(self): self._setup_for_dvr_test() reset_methods = ( 'reset_ovs_parameters', 'reset_dvr_parameters', 'setup_dvr_flows_on_integ_br', 'setup_dvr_flows_on_tun_br', 'setup_dvr_flows_on_phys_br', 'setup_dvr_mac_flows_on_all_brs') reset_mocks = [...
TypeError
dataset/ETHPy150Open openstack/neutron/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py/TestOvsDvrNeutronAgent.test_ovs_restart
2,971
def __getitem__(self, key): try: return dict.__getitem__(self, key) except __HOLE__: self[key] = value = self.creator(key) return value
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/PopulateDict.__getitem__
2,972
def __getitem__(self, key): try: return dict.__getitem__(self, key) except __HOLE__: return self.__missing__(key)
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/defaultdict.__getitem__
2,973
def __call__(self, *args): hashkey = (self, args) try: return ArgSingleton.instances[hashkey] except __HOLE__: instance = type.__call__(self, *args) ArgSingleton.instances[hashkey] = instance return instance
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/ArgSingleton.__call__
2,974
def format_argspec_init(method, grouped=True): """format_argspec_plus with considerations for typical __init__ methods Wraps format_argspec_plus with error handling strategies for typical __init__ cases:: object.__init__ -> (self) other unreflectable (usually C) -> (self, *args, **kwargs) ...
TypeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/format_argspec_init
2,975
def getargspec_init(method): """inspect.getargspec with considerations for typical __init__ methods Wraps inspect.getargspec with error handling for typical __init__ cases:: object.__init__ -> (self) other unreflectable (usually C) -> (self, *args, **kwargs) """ try: return inspec...
TypeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/getargspec_init
2,976
def monkeypatch_proxied_specials(into_cls, from_cls, skip=None, only=None, name='self.proxy', from_instance=None): """Automates delegation of __specials__ for a proxying type.""" if only: dunders = only else: if skip is None: skip = ('__slots__',...
TypeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/monkeypatch_proxied_specials
2,977
def __getattr__(self, key): try: return self._data[key] except __HOLE__: raise AttributeError(key)
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/OrderedProperties.__getattr__
2,978
def __delattr__(self, key): try: del self._tdict[(thread.get_ident(), key)] except __HOLE__: raise AttributeError(key)
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/ThreadLocal.__delattr__
2,979
def __getattr__(self, key): try: return self._tdict[(thread.get_ident(), key)] except __HOLE__: raise AttributeError(key)
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/ThreadLocal.__getattr__
2,980
def discard(self, value): try: self.remove(value) except __HOLE__: pass
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/IdentitySet.discard
2,981
def pop(self): try: pair = self._members.popitem() return pair[1] except __HOLE__: raise KeyError('pop from an empty set')
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/IdentitySet.pop
2,982
def __call__(self): key = self._get_key() try: return self.registry[key] except __HOLE__: return self.registry.setdefault(key, self.createfunc())
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/ScopedRegistry.__call__
2,983
def clear(self): try: del self.registry[self._get_key()] except __HOLE__: pass
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/ScopedRegistry.clear
2,984
def function_named(fn, name): """Return a function with a given __name__. Will assign to __name__ and return the original function if possible on the Python implementation, otherwise a new function will be constructed. """ try: fn.__name__ = name except __HOLE__: fn = new.funct...
TypeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/function_named
2,985
def cache_decorator(func): """apply caching to the return value of a function.""" name = '_cached_' + func.__name__ def do_with_cache(self, *args, **kwargs): try: return getattr(self, name) except __HOLE__: value = func(self, *args, **kwargs) setattr(sel...
AttributeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/cache_decorator
2,986
def reset_cached(instance, name): try: delattr(instance, '_cached_' + name) except __HOLE__: pass
AttributeError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/reset_cached
2,987
def _cleanup(self, wr, key=None): if key is None: key = wr.key try: del self._weakrefs[key] except (KeyError, AttributeError): # pragma: no cover pass # pragma: no cover try: del self.by_id[key] except (_...
KeyError
dataset/ETHPy150Open ralfonso/theory/theory/model/mpdutil.py/WeakIdentityMapping._cleanup
2,988
def main(self, args, initial_options): options, args = self.parser.parse_args(args) self.merge_options(initial_options, options) level = 1 # Notify level += options.verbose level -= options.quiet level = logger.level_for_integer(4 - level) complete_log = [] ...
KeyboardInterrupt
dataset/ETHPy150Open balanced/status.balancedpayments.com/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py/Command.main
2,989
def parse_markdown_readme(): """ Convert README.md to RST via pandoc, and load into memory (fallback to LONG_DESCRIPTION on failure) """ # Attempt to run pandoc on markdown file import subprocess try: subprocess.call( ['pandoc', '-t', 'rst', '-o', 'README.rst', 'README.md...
OSError
dataset/ETHPy150Open wq/wq.db/setup.py/parse_markdown_readme
2,990
def _positive_non_zero_int(argument_value): if argument_value is None: return None try: value = int(argument_value) except __HOLE__: msg = "%s must be an integer" % argument_value raise argparse.ArgumentTypeError(msg) if value <= 0: msg = "%s must be greater than ...
ValueError
dataset/ETHPy150Open openstack/python-cloudkittyclient/cloudkittyclient/shell.py/_positive_non_zero_int
2,991
def main(args=None): try: if args is None: args = sys.argv[1:] CloudkittyShell().main(args) except Exception as e: if '--debug' in args or '-d' in args: raise else: print(encodeutils.safe_encode(six.text_type(e)), file=sys.stderr) sys...
KeyboardInterrupt
dataset/ETHPy150Open openstack/python-cloudkittyclient/cloudkittyclient/shell.py/main
2,992
def get_thumbnail_name(self, thumbnail_options, transparent=False, high_resolution=False): """ A version of ``Thumbnailer.get_thumbnail_name`` that produces a reproducible thumbnail name that can be converted back to the original filename. """ p...
AttributeError
dataset/ETHPy150Open divio/django-filer/filer/utils/filer_easy_thumbnails.py/ThumbnailerNameMixin.get_thumbnail_name
2,993
def extend(headers, line): try: header = headers.pop() except __HOLE__: # this means that we got invalid header # ignore it return if isinstance(header, deque): header.append(line) headers.append(header) else: headers.append(deque((header, line)))
IndexError
dataset/ETHPy150Open mailgun/flanker/flanker/mime/message/headers/parsing.py/extend
2,994
def get_datacube_root(): """Return the directory containing the datacube python source files. This returns the value of the DATACUBE_ROOT environment variable if it is set, otherwise it returns the directory containing the source code for this function (cube_util.get_datacube_root). """ try: ...
KeyError
dataset/ETHPy150Open GeoscienceAustralia/agdc/src/cube_util.py/get_datacube_root
2,995
def parse_date_from_string(date_string): """Attempt to parse a date from a command line or config file argument. This function tries a series of date formats, and returns a date object if one of them works, None otherwise. """ format_list = ['%Y%m%d', '%d/%m/%Y', ...
ValueError
dataset/ETHPy150Open GeoscienceAustralia/agdc/src/cube_util.py/parse_date_from_string
2,996
def create_directory(dirname): """Create dirname, including any intermediate directories necessary to create the leaf directory.""" # Allow group permissions on the directory we are about to create old_umask = os.umask(0o007) try: os.makedirs(dirname) except __HOLE__, e: if e.err...
OSError
dataset/ETHPy150Open GeoscienceAustralia/agdc/src/cube_util.py/create_directory
2,997
def clean(self, value): value = super(ITSocialSecurityNumberField, self).clean(value) if value in EMPTY_VALUES: return '' value = re.sub('\s', '', value).upper() # Entities SSN are numeric-only if value.isdigit(): try: return vat_number_val...
ValueError
dataset/ETHPy150Open django/django-localflavor/localflavor/it/forms.py/ITSocialSecurityNumberField.clean
2,998
def clean(self, value): value = super(ITVatNumberField, self).clean(value) if value in EMPTY_VALUES: return '' try: return vat_number_validation(value) except __HOLE__: raise ValidationError(self.error_messages['invalid'])
ValueError
dataset/ETHPy150Open django/django-localflavor/localflavor/it/forms.py/ITVatNumberField.clean
2,999
def _create_test_db(self, verbosity, autoclobber): settings_dict = self.connection.settings_dict if self.connection._DJANGO_VERSION >= 13: test_name = self._get_test_db_name() else: if settings_dict['TEST_NAME']: test_name = settings_dict['TEST_NAME'] ...
ImportError
dataset/ETHPy150Open lionheart/django-pyodbc/django_pyodbc/creation.py/DatabaseCreation._create_test_db