Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
7,100
def last_run(self): "Returns the last completed run or None" try: query = RunInfoHistory.objects.filter(subject=self) return query.order_by('-completed')[0] except __HOLE__: return None
IndexError
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/Subject.last_run
7,101
def is_last(self): try: return self.questionnaire.questionsets()[-1] == self except __HOLE__: # should only occur if not yet saved return True
NameError
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/QuestionSet.is_last
7,102
def is_first(self): try: return self.questionnaire.questionsets()[0] == self except __HOLE__: # should only occur if not yet saved return True
NameError
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/QuestionSet.is_first
7,103
def remove_tags(self, tags): if not self.tags: return current_tags = self.tags.split(',') for tag in tags: try: current_tags.remove(tag) except __HOLE__: pass self.tags = ",".join(current_tags)
ValueError
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/RunInfo.remove_tags
7,104
def split_answer(self): """ Decode stored answer value and return as a list of choices. Any freeform value will be returned in a list as the last item. Calling code should be tolerant of freeform answers outside of additional [] if data has been stored in plain text format ...
ValueError
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/Answer.split_answer
7,105
def embed_interactive(**kwargs): """Embed an interactive terminal into a running python process """ if 'state' not in kwargs: kwargs['state'] = state if 'conf' not in kwargs: kwargs['conf'] = conf try: import IPython ipython_config = IPython.Config() ipython_...
ImportError
dataset/ETHPy150Open duerrp/pyexperiment/pyexperiment/utils/interactive.py/embed_interactive
7,106
def _runQueued(self, _TXresult, _TXIntent): self._aTB_numPendingTransmits -= 1 try: nextTransmit = self._aTB_queuedPendingTransmits.pop() except __HOLE__: return self._submitTransmit(nextTransmit)
IndexError
dataset/ETHPy150Open godaddy/Thespian/thespian/system/transport/asyncTransportBase.py/asyncTransportBase._runQueued
7,107
def __init__(self): try: # Needed for Python 3, see [http://bugs.python.org/issue21265] super(NoInterpolationParser, self).__init__(interpolation=None) except __HOLE__: # Python 2.x cp.ConfigParser.__init__(self)
TypeError
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/pypetlogging.py/NoInterpolationParser.__init__
7,108
def get_django_recorder(): try: import django from django.conf import settings from pyavatax.models import AvaTaxRecord except __HOLE__: return MockDjangoRecorder else: if hasattr(settings, 'NO_PYAVATAX_INTEGRATION') and settings.NO_PYAVATAX_INTEGRATION: r...
ImportError
dataset/ETHPy150Open activefrequency/pyavatax/pyavatax/django_integration.py/get_django_recorder
7,109
def value_from_raw(self, raw): if raw.value is None: return raw.missing_value('Missing sort key') try: return int(raw.value.strip()) except __HOLE__: return raw.bad_value('Bad sort key value')
ValueError
dataset/ETHPy150Open lektor/lektor-archive/lektor/types/special.py/SortKeyType.value_from_raw
7,110
def non_string_iterable(obj): try: iter(obj) except __HOLE__: return False else: return not isinstance(obj, str) # Minimal self test. You'll need a bunch of ICO files in the current working # directory in order for this to work...
TypeError
dataset/ETHPy150Open timeyyy/system_tray/system_tray/tray2.py/non_string_iterable
7,111
def __init__(self, replayFile): # The replayFile can be either the name of a file or any object that has a 'read()' method. self.mpq = mpyq.MPQArchive(replayFile) self.buildStormReplay = protocol15405.decode_replay_header(self.mpq.header['user_data_header']['content'])['m_version']['m_bas...
ImportError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.__init__
7,112
def getUniqueMatchId(self): try: return self.matchId except __HOLE__: self.matchId = "todo" return self.matchId
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getUniqueMatchId
7,113
def getReplayInitData(self): try: return self.replayInitData except __HOLE__: self.replayInitData = self.protocol.decode_replay_initdata(self.mpq.read_file('replay.initData')) return self.replayInitData
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayInitData
7,114
def getReplayDetails(self): try: return self.replayDetails except __HOLE__: self.replayDetails = self.protocol.decode_replay_details(self.mpq.read_file('replay.details')) return self.replayDetails # returns array indexed by user ID
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayDetails
7,115
def getReplayPlayers(self): try: return self.replayPlayers except __HOLE__: self.players = [None] * 10 for i, player in enumerate(self.getReplayDetails()['m_playerList']): #TODO: confirm that m_workingSetSlotId == i always toon =...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayPlayers
7,116
def getPlayerSpawnInfo(self): try: return self.playerSpawnInfo except __HOLE__: self.playerSpawnInfo = [None] * 10 players = self.getReplayPlayers() playerIdToUserId = {} for event in self.getReplayTrackerEvents(): if ev...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getPlayerSpawnInfo
7,117
def getReplayMessageEvents(self): try: return self.replayMessageEvents except __HOLE__: messageGenerator = self.protocol.decode_replay_message_events(self.mpq.read_file('replay.message.events')) self.replayMessageEvents = [] for event in messageGener...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayMessageEvents
7,118
def getMapName(self): try: return self.mapName except __HOLE__: self.mapName = self.getReplayDetails()['m_title'] return self.mapName
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getMapName
7,119
def getMatchUTCTimestamp(self): try: return self.utcTimestamp except __HOLE__: self.utcTimestamp = (self.getReplayDetails()['m_timeUTC'] / 10000000) - 11644473600 return self.utcTimestamp
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getMatchUTCTimestamp
7,120
def getChat(self): try: return self.chat except __HOLE__: self.chat = [] for messageEvent in self.getReplayMessageEvents(): if (messageEvent['_event'] != 'NNet.Game.SChatMessage'): continue userId = messageEv...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getChat
7,121
def getReplayGameEvents(self): try: return self.replayGameEvents except __HOLE__: generator = self.protocol.decode_replay_game_events(self.mpq.read_file('replay.game.events')) self.replayGameEvents = [] for event in generator: self.r...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayGameEvents
7,122
def getReplayGameEventsDebug(self): try: return self.replayGameEventsDebug except __HOLE__: generator = self.protocol.decode_replay_game_events_debug(self.mpq.read_file('replay.game.events')) self.replayGameEvents = [] try: i = 0 ...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayGameEventsDebug
7,123
def getReplayTrackerEvents(self): try: return self.replayTrackerEvents except __HOLE__: generator = self.protocol.decode_replay_tracker_events(self.mpq.read_file('replay.tracker.events')) self.replayTrackerEvents = [] for event in generator: ...
AttributeError
dataset/ETHPy150Open karlgluck/heroes-of-the-storm-replay-parser/api/StormReplayParser.py/StormReplayParser.getReplayTrackerEvents
7,124
@view_config(route_name='shortener_v1', renderer='jsonp') def url_shortener(request): incoming_url = request.params.get('url') if not incoming_url: raise httpexceptions.HTTPBadRequest() try: url_handler = Url(request, url=incoming_url) except __HOLE__: raise httpexceptions.HTTP...
ValueError
dataset/ETHPy150Open gustavofonseca/nurl/nurl/views.py/url_shortener
7,125
def setUp(self): ''' No need to add a dummy foo.txt to muddy up the github repo, just make our own fileserver root on-the-fly. ''' def _new_dir(path): ''' Add a new dir at ``path`` using os.makedirs. If the directory already exists, remove it r...
OSError
dataset/ETHPy150Open saltstack/salt/tests/integration/fileclient_test.py/FileclientTest.setUp
7,126
def notify(self, request_payload): """Initiates a review by placing a message on the message queue.""" self.celery.conf.BROKER_URL = self.settings['BROKER_URL'] review_settings = { 'max_comments': self.settings['max_comments'], } payload = { 'request': re...
ObjectDoesNotExist
dataset/ETHPy150Open reviewboard/ReviewBot/extension/reviewbotext/extension.py/ReviewBotExtension.notify
7,127
def print_size(self, text): size_total = int(self.params.get('upload.maximum_size')) size_data_total = int(self.params.get('upload.maximum_data_size')) size_regex = self.params.get('recipe.size.regex') pattern = re.compile(size_regex, re.M) result = pattern.findall(text) ...
TypeError
dataset/ETHPy150Open Robot-Will/Stino/stino/pyarduino/arduino_compiler.py/Compiler.print_size
7,128
def is_process_alive(pid): """Sends null signal to a process to check if it's alive""" try: # Sending the null signal (sig. 0) to the process will check # pid's validity. os.kill(pid, 0) except __HOLE__, e: # Access denied, but process is alive return e.errno == errno...
OSError
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/core/pid.py/is_process_alive
7,129
def kill_processes(pids): while pids: pid = pids.pop() if is_process_alive(pid): try: logging.info("Sending SIGKILL to PID: %d" % pid) os.kill(pid, 9) except __HOLE__, e: if e.errno == errno.ESRCH: # process ...
OSError
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/core/pid.py/kill_processes
7,130
def check(path): try: logging.info("Checking pidfile '%s'", path) pids = [int(pid) for pid in open(path).read().strip().split(' ')] kill_processes(pids) except __HOLE__, (code, text): if code == errno.ENOENT: logging.warning("pidfile '%s' not found" % path) el...
IOError
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/core/pid.py/check
7,131
def mkdir(path): try: os.mkdir(path) except __HOLE__: pass
OSError
dataset/ETHPy150Open arq5x/gemini/gemini/gemini_bcolz.py/mkdir
7,132
def filter(db, query, user_dict): # these should be translated to a bunch or or/and statements within gemini # so they are supported, but must be translated before getting here. if query == "False" or query is None or query is False: return [] if "any(" in query or "all(" in query or \ ("...
AttributeError
dataset/ETHPy150Open arq5x/gemini/gemini/gemini_bcolz.py/filter
7,133
def test_validate_bug_tracker(self): """Testing bug tracker url form field validation""" # Invalid - invalid format specification types self.assertRaises(ValidationError, validate_bug_tracker, "%20") self.assertRaises(ValidationError, validate_bug_tracker, "%d") # Invalid - too ...
ValidationError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/admin/tests.py/ValidatorTests.test_validate_bug_tracker
7,134
def geocode(self, query, **kwargs): """ Given a string to search for, return the results from OpenCage's Geocoder. :param string query: String to search for :returns: Dict results :raises InvalidInputError: if the query string is not a unicode string :raises RateLimitEx...
ValueError
dataset/ETHPy150Open OpenCageData/python-opencage-geocoder/opencage/geocoder.py/OpenCageGeocode.geocode
7,135
def float_if_float(float_string): try: float_val = float(float_string) return float_val except __HOLE__: return float_string
ValueError
dataset/ETHPy150Open OpenCageData/python-opencage-geocoder/opencage/geocoder.py/float_if_float
7,136
def manipulator_validator_unique(f, opts, self, field_data, all_data): "Validates that the value is unique for this field." lookup_type = f.get_validator_unique_lookup_type() try: old_obj = self.manager.get(**{lookup_type: field_data}) except __HOLE__: return if getattr(self, 'origin...
ObjectDoesNotExist
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/manipulator_validator_unique
7,137
def get_db_prep_lookup(self, lookup_type, value): "Returns field's value prepared for database lookup." if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'month', 'day', 'search'): return [value] elif lookup_type in ('range', 'in'): return value elif lookup_ty...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/Field.get_db_prep_lookup
7,138
def to_python(self, value): if value is None: return value try: return int(value) except (TypeError, __HOLE__): raise validators.ValidationError, gettext("This value must be an integer.")
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/AutoField.to_python
7,139
def to_python(self, value): if value is None: return value if isinstance(value, datetime.datetime): return value.date() if isinstance(value, datetime.date): return value validators.isValidANSIDate(value, None) try: return datetime.d...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/DateField.to_python
7,140
def to_python(self, value): if value is None: return value if isinstance(value, datetime.datetime): return value if isinstance(value, datetime.date): return datetime.datetime(value.year, value.month, value.day) try: # Seconds are optional, so try conve...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/DateTimeField.to_python
7,141
def update_result(self, context): # NOQA super(GlbCorp, self).update_result(context) self.monitor.stop() iteration = 0 results = [] with open(self.logcat_log) as fh: try: line = fh.next() result_lines = [] while True: ...
StopIteration
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/workloads/glbcorp/__init__.py/GlbCorp.update_result
7,142
def postOptions(self): if not self['control-node']: raise UsageError("Control node address must be provided.") if not self['cert-directory']: raise UsageError("Certificates directory must be provided.") if self['wait'] is not None: try: self['w...
ValueError
dataset/ETHPy150Open ClusterHQ/flocker/benchmark/cluster_cleanup.py/ScriptOptions.postOptions
7,143
def _calculate_log_likelihood(self): #if self.m == None: # Give error message R = zeros((self.n, self.n)) X, Y = array(self.X), array(self.Y) thetas = 10.**self.thetas #weighted distance formula for i in range(self.n): R[i, i+1:self.n] = e**(-sum(t...
ValueError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/surrogatemodels/kriging_surrogate.py/KrigingSurrogate._calculate_log_likelihood
7,144
def getheightwidth(self): """ getwidth() -> (int, int) Return the height and width of the console in characters https://groups.google.com/forum/#!msg/comp.lang.python/CpUszNNXUQM/QADpl11Z-nAJ""" try: return int(os.environ["LINES"]), int(os.environ["COLUMNS"]) except ...
KeyError
dataset/ETHPy150Open gapato/livestreamer-curses/src/livestreamer_curses/streamlist.py/StreamList.getheightwidth
7,145
def check_stopped_streams(self): finished = self.q.get_finished() for f in finished: for s in self.streams: try: i = self.filtered_streams.index(s) except __HOLE__: continue if f == s['id']: ...
ValueError
dataset/ETHPy150Open gapato/livestreamer-curses/src/livestreamer_curses/streamlist.py/StreamList.check_stopped_streams
7,146
def run_from_command_line(): logging.basicConfig(level=logging.INFO, format='%(message)s') try: relation_name = iepy.instance.rules.RELATION except AttributeError: logging.error("RELATION not defined in rules file") sys.exit(1) try: relation = models.Relation.objects.ge...
ObjectDoesNotExist
dataset/ETHPy150Open machinalis/iepy/iepy/instantiation/iepy_rules_runner.py/run_from_command_line
7,147
@staticmethod def _sign_string(message, private_key_file=None, private_key_string=None): """ Signs a string for use with Amazon CloudFront. Requires the M2Crypto library be installed. """ try: from M2Crypto import EVP except __HOLE__: raise No...
ImportError
dataset/ETHPy150Open darcyliu/storyboard/boto/cloudfront/distribution.py/Distribution._sign_string
7,148
def describe_directory(self, path): """ Returns a dictionary of {filename: {attributes}} for all files on the remote system (where the MLSD command is supported). :param path: full path to the remote directory :type path: str """ conn = self.get_conn() co...
AttributeError
dataset/ETHPy150Open airbnb/airflow/airflow/contrib/hooks/ftp_hook.py/FTPHook.describe_directory
7,149
def CreateServer(self): with open(self.filename) as stream: appinfo_external = appinfo_includes.Parse(stream) appengine_config = vmconfig.BuildVmAppengineEnvConfig() vmstub.Register(vmstub.VMStub(appengine_config.default_ticket)) if 'googleclouddebugger' in sys.modules: try: ...
ImportError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/vmruntime/vmservice.py/VmService.CreateServer
7,150
@classmethod def check(cls): super(YouTubeView, cls).check() try: from gdata.youtube.service import YouTubeService except ImportError: raise DisableView('YouTubeView requires "gdata" library ' '(http://pypi.python.org/pypi/gdata)') ...
AttributeError
dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/views.py/YouTubeView.check
7,151
@classmethod def check(cls): super(FlickrView, cls).check() try: import flickrapi except __HOLE__: raise DisableView('FlickrView requires the "flickrapi" library ' '(http://pypi.python.org/pypi/flickrapi)') try: django...
ImportError
dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/views.py/FlickrView.check
7,152
@classmethod def check(cls): super(VimeoView, cls).check() try: django_settings.ADMINFILES_VIMEO_USER except AttributeError: raise DisableView('VimeoView requires ' 'ADMINFILES_VIMEO_USER setting') try: cls.pages = dja...
AttributeError
dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/views.py/VimeoView.check
7,153
def _get_videos(self, url): import urllib2 try: import xml.etree.ElementTree as ET except __HOLE__: import elementtree.ElementTree as ET request = urllib2.Request(url) request.add_header('User-Agent', 'django-adminfiles/0.x') root = ET.parse(urllib...
ImportError
dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/views.py/VimeoView._get_videos
7,154
def get_enabled_browsers(): """ Check the ADMINFILES_BROWSER_VIEWS setting and return a list of instantiated browser views that have the necessary dependencies/configuration to run. """ global _enabled_browsers_cache if _enabled_browsers_cache is not None: return _enabled_browsers_c...
ImportError
dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/views.py/get_enabled_browsers
7,155
def __enter__(self): try: return next(self.gen) except __HOLE__: raise RuntimeError("generator didn't yield")
StopIteration
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/contextlib.py/_GeneratorContextManager.__enter__
7,156
def __exit__(self, type, value, traceback): if type is None: try: next(self.gen) except __HOLE__: return else: raise RuntimeError("generator didn't stop") else: if value is None: # Need to for...
StopIteration
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/contextlib.py/_GeneratorContextManager.__exit__
7,157
def push(self, exit): """Registers a callback with the standard __exit__ method signature Can suppress exceptions the same way __exit__ methods can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself) """ # We ...
AttributeError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/contextlib.py/ExitStack.push
7,158
def write_config(self): """ Generates the shader configuration for the common inputs """ content = self._input_ubo.generate_shader_code() try: # Try to write the temporary file with open("/$$rptemp/$$main_scene_data.inc.glsl", "w") as handle: handle.write(...
IOError
dataset/ETHPy150Open tobspr/RenderPipeline/rpcore/common_resources.py/CommonResources.write_config
7,159
def _cache_support(self, expire_time, fragm_name, vary_on, lineno, caller): try: expire_time = int(expire_time) except (ValueError, __HOLE__): raise TemplateSyntaxError('"%s" tag got a non-integer timeout ' 'value: %r' % (list(self.tags)[0], expire_time), lineno) ...
TypeError
dataset/ETHPy150Open niwinz/django-jinja/django_jinja/builtins/extensions.py/CacheExtension._cache_support
7,160
def test_ckdtree_pickle(): # test if it is possible to pickle # a cKDTree try: import cPickle as pickle except __HOLE__: import pickle np.random.seed(0) n = 50 k = 4 points = np.random.randn(n, k) T1 = cKDTree(points) tmp = pickle.dumps(T1) T2 = pickle.loads(t...
ImportError
dataset/ETHPy150Open scipy/scipy/scipy/spatial/tests/test_kdtree.py/test_ckdtree_pickle
7,161
def test_ckdtree_pickle_boxsize(): # test if it is possible to pickle a periodic # cKDTree try: import cPickle as pickle except __HOLE__: import pickle np.random.seed(0) n = 50 k = 4 points = np.random.uniform(size=(n, k)) T1 = cKDTree(points, boxsize=1.0) tmp = p...
ImportError
dataset/ETHPy150Open scipy/scipy/scipy/spatial/tests/test_kdtree.py/test_ckdtree_pickle_boxsize
7,162
def test_ckdtree_box_upper_bounds(): data = np.linspace(0, 2, 10).reshape(-1, 1) try: cKDTree(data, leafsize=1, boxsize=1.0) except __HOLE__: return raise AssertionError("ValueError is not raised")
ValueError
dataset/ETHPy150Open scipy/scipy/scipy/spatial/tests/test_kdtree.py/test_ckdtree_box_upper_bounds
7,163
def test_ckdtree_box_lower_bounds(): data = np.linspace(-1, 1, 10) try: cKDTree(data, leafsize=1, boxsize=1.0) except __HOLE__: return raise AssertionError("ValueError is not raised")
ValueError
dataset/ETHPy150Open scipy/scipy/scipy/spatial/tests/test_kdtree.py/test_ckdtree_box_lower_bounds
7,164
def test_ckdtree_memuse(): # unit test adaptation of gh-5630 try: import resource except __HOLE__: # resource is not available on Windows with Python 2.6 return # Make some data dx, dy = 0.05, 0.05 y, x = np.mgrid[slice(1, 5 + dy, dy), slice(1, 5 + dx,...
ImportError
dataset/ETHPy150Open scipy/scipy/scipy/spatial/tests/test_kdtree.py/test_ckdtree_memuse
7,165
@c3bottles.route("/report", methods=("GET", "POST")) @c3bottles.route("/<int:number>") def report(number=None): if number: dp = DropPoint.get(number) else: dp = DropPoint.get(request.values.get("number")) if not dp or dp.removed: return render_template( "error.html", ...
ValueError
dataset/ETHPy150Open der-michik/c3bottles/view/report.py/report
7,166
def on_iter_next(self, rowref): n = self.on_get_path(rowref) try: rowref = self._model_data[n+1] except __HOLE__, msg: rowref = None return rowref
IndexError
dataset/ETHPy150Open anandology/pyjamas/pygtkweb/demos/071-generictreemodel.py/MyTreeModel.on_iter_next
7,167
def __getitem__(self, name): try: return dict.__getitem__(self, name) except __HOLE__: if self.parent: return self.parent[name] else: raise
KeyError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/__init__.py/HierarchicalDict.__getitem__
7,168
def parseCallable(targetCall, name, user_args, user_kwargs): ''' ''' # # Check callable given # import inspect if not (inspect.ismethod(targetCall) or inspect.isfunction(targetCall)): raise GraphError("Callable must be a function or method.") # Common args callableArgs = {}...
TypeError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/__init__.py/parseCallable
7,169
def execNode(self, pCommand): """ | Emulate the execution of a command on a worker node. | 2 possible execution mode: with a subprocess or direct | - Calls the "commandwatcher.py" script used by the worker \ process to keep a similar behaviour | Command output and e...
KeyboardInterrupt
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/__init__.py/Graph.execNode
7,170
def getTaskIndex(self, task): try: return self.taskMem[task] except __HOLE__: return self.addTask(task)
KeyError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/__init__.py/GraphDumper.getTaskIndex
7,171
@classmethod def generateQuaggaBoot(cls, node, services): ''' Generate a shell script used to boot the Quagga daemons. ''' try: quagga_bin_search = node.session.cfg['quagga_bin_search'] quagga_sbin_search = node.session.cfg['quagga_sbin_search'] except __HOLE_...
KeyError
dataset/ETHPy150Open coreemu/core/daemon/core/services/quagga.py/Zebra.generateQuaggaBoot
7,172
def watch(self, key, recurse=False, timeout=0, index=None): ret = { 'key': key, 'value': None, 'changed': False, 'mIndex': 0, 'dir': False } try: result = self.read(key, recursive=recurse, wait=True, timeout=timeout, waitInd...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.watch
7,173
def get(self, key, recurse=False): try: result = self.read(key, recursive=recurse) except etcd.EtcdKeyNotFound: # etcd already logged that the key wasn't found, no need to do # anything here but return return None except etcd.EtcdConnectionFailed: ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.get
7,174
def read(self, key, recursive=False, wait=False, timeout=None, waitIndex=None): try: if waitIndex: result = self.client.read(key, recursive=recursive, wait=wait, timeout=timeout, waitIndex=waitIndex) else: result = self.client.read(key, recursive=recursive...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.read
7,175
def write(self, key, value, ttl=None, directory=False): # directories can't have values, but have to have it passed if directory: value = None try: result = self.client.write(key, value, ttl=ttl, dir=directory) except (etcd.EtcdNotFile, etcd.EtcdNotDir, etcd.EtcdR...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.write
7,176
def ls(self, path): ret = {} try: items = self.read(path) except (etcd.EtcdKeyNotFound, __HOLE__): return {} except etcd.EtcdConnectionFailed: log.error("etcd: failed to perform 'ls' operation on path {0} due to connection error".format(path)) ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.ls
7,177
def delete(self, key, recursive=False): try: if self.client.delete(key, recursive=recursive): return True else: return False except (etcd.EtcdNotFile, etcd.EtcdRootReadOnly, etcd.EtcdDirNotEmpty, etcd.EtcdKeyNotFound, __HOLE__) as err: ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.delete
7,178
def tree(self, path): ''' .. versionadded:: 2014.7.0 Recurse through etcd and return all values ''' ret = {} try: items = self.read(path) except (etcd.EtcdKeyNotFound, __HOLE__): return None except etcd.EtcdConnectionFailed: ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/etcd_util.py/EtcdClient.tree
7,179
def load(self): try: s = MongoSession.objects(session_key=self.session_key, expire_date__gt=datetime_now)[0] if MONGOENGINE_SESSION_DATA_ENCODE: return self.decode(force_text(s.session_data)) else: return s....
IndexError
dataset/ETHPy150Open MongoEngine/django-mongoengine/django_mongoengine/sessions.py/SessionStore.load
7,180
def main(): try: hostname = raw_input("Enter remote host to test: ") except __HOLE__: hostname = input("Enter remote host to test: ") home_dir = (path.expanduser('~')) key_file = "{}/.ssh/cisco_rsa".format(home_dir) cisco_test = { 'ip': hostname, 'username': '...
NameError
dataset/ETHPy150Open ktbyers/netmiko/tests/test_cisco_w_key.py/main
7,181
def send(self, input): if not self.stdin: return None try: x = msvcrt.get_osfhandle(self.stdin.fileno()) (errCode, written) = WriteFile(x, input) except __HOLE__: return self._close('stdin') except (subprocess.pywintypes.error, Exception), why: if why[0] in (109, errno.ESHUTDOWN): ...
ValueError
dataset/ETHPy150Open owtf/owtf/framework/shell/async_subprocess.py/AsyncPopen.send
7,182
def _recv(self, which, maxsize): conn, maxsize = self.get_conn_maxsize(which, maxsize) if conn is None: return None try: x = msvcrt.get_osfhandle(conn.fileno()) (read, nAvail, nMessage) = PeekNamedPipe(x, 0) if maxsize < nAvail: nAvail = maxsize if nAvail > 0: (errCode, read) = R...
ValueError
dataset/ETHPy150Open owtf/owtf/framework/shell/async_subprocess.py/AsyncPopen._recv
7,183
def send(self, input): if not self.stdin: return None if not select.select([], [self.stdin], [], 0)[1]: return 0 try: written = os.write(self.stdin.fileno(), input) except __HOLE__, why: if why[0] == errno.EPIPE: #broken pipe return self._close('stdin') raise return written
OSError
dataset/ETHPy150Open owtf/owtf/framework/shell/async_subprocess.py/AsyncPopen.send
7,184
@blueprint.route('/login', methods=['GET','POST']) def login(): """ Ask for a username (no password required) Sets a cookie """ # Get the URL to redirect to after logging in next_url = utils.routing.get_request_arg('next') or \ flask.request.referrer or flask.url_for('.home') if...
ValueError
dataset/ETHPy150Open NVIDIA/DIGITS/digits/views.py/login
7,185
def _PopLine(self): while len(self._current_line) <= self._column: try: self._current_line = next(self._lines) except __HOLE__: self._current_line = '' self._more_lines = False return else: self._line += 1 self._column = 0
StopIteration
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer._PopLine
7,186
def ConsumeInt32(self): """Consumes a signed 32bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 32bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=True, is_long=False) except __HOLE__ as e: raise self...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeInt32
7,187
def ConsumeUint32(self): """Consumes an unsigned 32bit integer number. Returns: The integer parsed. Raises: ParseError: If an unsigned 32bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=False, is_long=False) except __HOLE__ as e: ra...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeUint32
7,188
def ConsumeInt64(self): """Consumes a signed 64bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 64bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=True, is_long=True) except __HOLE__ as e: raise self....
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeInt64
7,189
def ConsumeUint64(self): """Consumes an unsigned 64bit integer number. Returns: The integer parsed. Raises: ParseError: If an unsigned 64bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=False, is_long=True) except __HOLE__ as e: rai...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeUint64
7,190
def ConsumeFloat(self): """Consumes an floating point number. Returns: The number parsed. Raises: ParseError: If a floating point number couldn't be consumed. """ try: result = ParseFloat(self.token) except __HOLE__ as e: raise self._ParseError(str(e)) self.NextToke...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeFloat
7,191
def ConsumeBool(self): """Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed. """ try: result = ParseBool(self.token) except __HOLE__ as e: raise self._ParseError(str(e)) self.NextToken() return result
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeBool
7,192
def ConsumeString(self): """Consumes a string value. Returns: The string parsed. Raises: ParseError: If a string value couldn't be consumed. """ the_bytes = self.ConsumeByteString() try: return six.text_type(the_bytes, 'utf-8') except __HOLE__ as e: raise self._Stri...
UnicodeDecodeError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeString
7,193
def _ConsumeSingleByteString(self): """Consume one token of a string literal. String literals (whether bytes or text) can come in multiple adjacent tokens which are automatically concatenated, like in C or Python. This method only consumes one token. Raises: ParseError: When the wrong forma...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer._ConsumeSingleByteString
7,194
def ConsumeEnum(self, field): try: result = ParseEnum(field, self.token) except __HOLE__ as e: raise self._ParseError(str(e)) self.NextToken() return result
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/_Tokenizer.ConsumeEnum
7,195
def ParseInteger(text, is_signed=False, is_long=False): """Parses an integer. Args: text: The text to parse. is_signed: True if a signed integer must be parsed. is_long: True if a long integer must be parsed. Returns: The integer value. Raises: ValueError: Thrown Iff the text is not a val...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/ParseInteger
7,196
def ParseFloat(text): """Parse a floating point number. Args: text: Text to parse. Returns: The number parsed. Raises: ValueError: If a floating point number couldn't be parsed. """ try: # Assume Python compatible syntax. return float(text) except ValueError: # Check alternative...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/ParseFloat
7,197
def ParseEnum(field, value): """Parse an enum value. The value can be specified by a number (the enum value), or by a string literal (the enum name). Args: field: Enum field descriptor. value: String value. Returns: Enum value number. Raises: ValueError: If the enum value could not be pa...
ValueError
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/text_format.py/ParseEnum
7,198
@defer.inlineCallbacks def on_GET(self, request, user_id, filter_id): target_user = UserID.from_string(user_id) requester = yield self.auth.get_user_by_req(request) if target_user != requester.user: raise AuthError(403, "Cannot get filters for other users") if not self....
KeyError
dataset/ETHPy150Open matrix-org/synapse/synapse/rest/client/v2_alpha/filter.py/GetFilterRestServlet.on_GET
7,199
def getMelRepresentation( args, recursionLimit=None, maintainDicts=True): """Will return a list which contains each element of the iterable 'args' converted to a mel-friendly representation. :Parameters: recursionLimit : int or None If an element of args is itself iterable, recursionLimit s...
AttributeError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/pmcmds.py/getMelRepresentation