Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
200
def main(): """Run the tests.""" parsed_args = _PARSER.parse_args() if parsed_args.test_target and parsed_args.test_path: raise Exception('At most one of test_path and test_target ' 'should be specified.') if parsed_args.test_path and '.' in parsed_args.test_path: ...
AttributeError
dataset/ETHPy150Open oppia/oppia/scripts/backend_tests.py/main
201
def __init__(self, result_string, active_mode=False): """Set 'active_mode' to True to parse results in an Active Learning context.""" self.raw_output = result_string result_list = [] # TODO: Something more robust than whitespace splitting # to handle modes like --audit ...
ValueError
dataset/ETHPy150Open mokelly/wabbit_wappa/wabbit_wappa/__init__.py/VWResult.__init__
202
def post(self, request, *args, **kwargs): """Handler for HTTP POST requests.""" context = self.get_context_data(**kwargs) workflow = context[self.context_object_name] try: # Check for the VALIDATE_STEP* headers, if they are present # and valid integers, return val...
ValueError
dataset/ETHPy150Open CiscoSystems/avos/horizon/workflows/views.py/WorkflowView.post
203
def getcallargs(func, *positional, **named): """Get the mapping of arguments to values. A dict is returned, with keys the function argument names (including the names of the * and ** arguments, if any), and values the respective bound values from 'positional' and 'named'.""" args, varargs, varkw, d...
StopIteration
dataset/ETHPy150Open GrahamDumpleton/wrapt/src/wrapt/arguments.py/getcallargs
204
def highlight_syntax(src, lang, linenums=False): """Pass code to the [Pygments](http://pygments.pocoo.org/) highliter with optional line numbers. The output should then be styled with CSS to your liking. No styles are applied by default - only styling hooks (i.e.: <span class="k">). """ src = s...
ValueError
dataset/ETHPy150Open lucuma/Clay/clay/markdown_ext/md_fencedcode.py/highlight_syntax
205
def to_representation(self, value): # Create a dict from the GEOSGeometry when the value is not previously # serialized from the spatial db. try: return {'type': value.geom_type, 'coordinates': value.coords} # Value is already serialized as geojson, kml, etc. except _...
AttributeError
dataset/ETHPy150Open bkg/django-spillway/spillway/fields.py/GeometryField.to_representation
206
def run(self, context): cmd = "echo $$>{dir}/pidfile; exec {dir}/recentfling.sh -i {}; rm {dir}/pidfile" cmd = cmd.format(self.loops, dir=self.device.working_directory) try: self.output = self.device.execute(cmd, timeout=120) except __HOLE__: self._kill_recentflin...
KeyboardInterrupt
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/workloads/recentfling/__init__.py/Recentfling.run
207
def create_from_exception(self, exception=None, traceback=None, **kwargs): """ Creates an error log from an exception. """ if not exception: exc_type, exc_value, traceback = sys.exc_info() elif not traceback: warnings.warn('Using just the ``exception`` arg...
UnicodeDecodeError
dataset/ETHPy150Open dcramer/django-db-log/djangodblog/manager.py/DBLogManager.create_from_exception
208
def _on_path_loaded(self, path): if os.path.normpath(path) != self._root_path: return try: self.setModel(self._fs_model_proxy) file_root_index = self._fs_model_source.setRootPath( self._root_path) root_index = self._fs_model_proxy.mapFromSo...
RuntimeError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemTreeView._on_path_loaded
209
def _paste(self, sources, destination, copy): """ Copies the files listed in ``sources`` to destination. Source are removed if copy is set to False. """ for src in sources: debug('%s <%s> to <%s>' % ( 'copying' if copy else 'cutting', src, destination)...
OSError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemHelper._paste
210
def delete(self): """ Deletes the selected items. """ urls = self.selected_urls() rep = QtWidgets.QMessageBox.question( self.tree_view, _('Confirm delete'), _('Are you sure about deleting the selected files?'), QtWidgets.QMessageBox.Yes | QtWid...
OSError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemHelper.delete
211
def create_directory(self): """ Creates a directory under the selected directory (if the selected item is a file, the parent directory is used). """ src = self.get_current_path() name, status = QtWidgets.QInputDialog.getText( self.tree_view, _('Create director...
OSError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemHelper.create_directory
212
def create_file(self): """ Creates a file under the current directory. """ src = self.get_current_path() name, status = QtWidgets.QInputDialog.getText( self.tree_view, _('Create new file'), _('File name:'), QtWidgets.QLineEdit.Normal, '') if status...
OSError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemHelper.create_file
213
def connect(dbhandle, attach=None): """attempt to connect to database. If `dbhandle` is an existing connection to a database, it will be returned unchanged. Otherwise, this method will attempt to establish a connection. Arguments --------- dbhandle : object or string A database han...
ImportError
dataset/ETHPy150Open CGATOxford/cgat/CGAT/Database.py/connect
214
def load_assets(self): from frappe.modules import get_module_path, scrub import os page_name = scrub(self.name) path = os.path.join(get_module_path(self.module), 'page', page_name) # script fpath = os.path.join(path, page_name + '.js') if os.path.exists(fpath): with open(fpath, 'r') as f: self.s...
ImportError
dataset/ETHPy150Open frappe/frappe/frappe/core/doctype/page/page.py/Page.load_assets
215
def getDefault(self, key, context=None): #print "getting default for key", key, self.defaults # 1) Check on the request current = self.defaults.get(key, None) if current is None: # 2) Check on the session if context is not None: sessionDefaults = c...
KeyError
dataset/ETHPy150Open twisted/nevow/formless/formutils.py/FormDefaults.getDefault
216
def calculatePostURL(context, data): postLocation = inevow.ICurrentSegments(context)[-1] if postLocation == '': postLocation = '.' try: configurableKey = context.locate(iformless.IConfigurableKey) except __HOLE__: #print "IConfigurableKey was not remembered when calculating full ...
KeyError
dataset/ETHPy150Open twisted/nevow/formless/formutils.py/calculatePostURL
217
def applyHistory(self, axis_object): string_count = {} for cp in self.__command_list: log_string = cp.log_string try: count = string_count[log_string] string_count[log_string] += 1 except __HOLE__: string_count[log_str...
KeyError
dataset/ETHPy150Open hoytak/lazyrunner/lazyrunner/pmodule/axisproxy.py/AxisProxy.applyHistory
218
def main(): from sys import argv if len(argv) < 4: print "%s <Filter Name> <run|rerun|visualize> <osmdb_file> [<filter args> ...]" % argv[0] print "Filters:" for k,v in globals().items(): if type(v) == type and issubclass(v,OSMDBFilter): print " -- %s" % k ...
KeyError
dataset/ETHPy150Open bmander/graphserver/pygs/graphserver/ext/osm/osmfilters.py/main
219
def handle(self, *args, **options): # NoQA """ Execute the command. """ # Load the settings self.require_settings(args, options) # Load your AWS credentials from ~/.aws/credentials self.load_credentials() try: # Tail the available logs ...
KeyboardInterrupt
dataset/ETHPy150Open Miserlou/django-zappa/django_zappa/management/commands/tail.py/Command.handle
220
def main(): try: signal.signal(signal.SIGTSTP, signal.SIG_IGN) # ignore CTRL+Z signal.signal(signal.SIGINT, signal_handler) # custom CTRL+C handler except AttributeError: # OS Does not support some signals, probably windows pass if len(sys.argv) == 1: usage() # defau...
OSError
dataset/ETHPy150Open farrokhi/dnstools/dnsping.py/main
221
def get_caller(skip=0, get_dump=False): # this whole thing fails if we're not in a valid directory try: cwd = os.getcwd() except __HOLE__ as e: return '~could not get caller (current directory not valid)~' stack = inspect.stack(3) if len(inspect.stack()) < 3 + skip: return '...
OSError
dataset/ETHPy150Open mono/bockbuild/bockbuild/util/util.py/get_caller
222
def delete(path): trace('deleting %s' % path) if not os.path.isabs(path): raise BockbuildException('Relative paths are not allowed: %s' % path) if not os.path.lexists(path): raise CommandException('Invalid path to rm: %s' % path) if os.getcwd() == path: raise BockbuildException...
OSError
dataset/ETHPy150Open mono/bockbuild/bockbuild/util/util.py/delete
223
def is_running(pid): try: kill(pid, 0) except __HOLE__ as error: if error.errno == ESRCH: return False return True
OSError
dataset/ETHPy150Open circuits/circuits/tests/app/test_daemon.py/is_running
224
def test_all_instantiable(self): """Test if all the TVTK classes can be instantiated""" errors = [] for name in self.names: klass = getattr(vtk, name) tvtk_name = get_tvtk_name(name) tvtk_klass = getattr(tvtk, tvtk_name, None) if hasattr(klass, '__...
TypeError
dataset/ETHPy150Open enthought/mayavi/tvtk/tests/test_tvtk.py/TestTVTKModule.test_all_instantiable
225
def latest(name, rev='HEAD', target=None, branch=None, user=None, update_head=True, force_checkout=False, force_clone=False, force_fetch=False, force_reset=False, submodules=False, bare=False, ...
OSError
dataset/ETHPy150Open saltstack/salt/salt/states/git.py/latest
226
def present(name, force=False, bare=True, template=None, separate_git_dir=None, shared=None, user=None): ''' Ensure that a repository exists in the given directory .. warning:: If the minion has Git 2.5 or later installed, ``na...
OSError
dataset/ETHPy150Open saltstack/salt/salt/states/git.py/present
227
def detached(name, ref, target=None, remote='origin', user=None, force_clone=False, force_checkout=False, fetch_remote=True, hard_reset=False, submodules=False, identity=None, https_user=None, ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/states/git.py/detached
228
def config_set(name, value=None, multivar=None, repo=None, user=None, **kwargs): ''' .. versionadded:: 2014.7.0 .. versionchanged:: 2015.8.0 Renamed from ``git.config`` to ``git.config_set``. For earlier versions, use...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/states/git.py/config_set
229
def get_object(self, queryset=None): """ Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the URLconf, but subclasses can override this to return any object. """ # Use a custom queryset if provided; this...
ObjectDoesNotExist
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/views/generic/detail.py/SingleObjectMixin.get_object
230
def _get_image_from_file(dir_path, image_file): """ Get an instance of PIL.Image from the given file. @param {String} dir_path - The directory containing the image file @param {String} image_file - The filename of the image file within dir_path @return {PIL.Image} An instance of the image file as...
IOError
dataset/ETHPy150Open unwitting/imageme/imageme.py/_get_image_from_file
231
def _get_src_from_image(img, fallback_image_file): """ Get base-64 encoded data as a string for the given image. Fallback to return fallback_image_file if cannot get the image data or img is None. @param {Image} img - The PIL Image to get src data for @param {String} fallback_image_file - The file...
IOError
dataset/ETHPy150Open unwitting/imageme/imageme.py/_get_src_from_image
232
def _get_thumbnail_image_from_file(dir_path, image_file): """ Get a PIL.Image from the given image file which has been scaled down to THUMBNAIL_WIDTH wide. @param {String} dir_path - The directory containing the image file @param {String} image_file - The filename of the image file within dir_path...
IOError
dataset/ETHPy150Open unwitting/imageme/imageme.py/_get_thumbnail_image_from_file
233
def _run_server(): """ Run the image server. This is blocking. Will handle user KeyboardInterrupt and other exceptions appropriately and return control once the server is stopped. @return {None} """ # Get the port to run on port = _get_server_port() # Configure allow_reuse_address t...
KeyboardInterrupt
dataset/ETHPy150Open unwitting/imageme/imageme.py/_run_server
234
@classmethod def unpack (cls, data, negotiated): try: if cls.cached: if data == cls.previous: return cls.cached # # This code may mess with the cached data # elif cls.previous and data.startswith(cls.previous): # attributes = Attributes() # for key in cls.cached: # attributes[key]...
IndexError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/bgp/message/update/attribute/attributes.py/Attributes.unpack
235
def sameValuesAs (self, other): # we sort based on packed values since the items do not # necessarily implement __cmp__ def sorter (x, y): return cmp(x.pack(), y.pack()) try: for key in set(self.iterkeys()).union(set(other.iterkeys())): if (key == Attribute.CODE.MP_REACH_NLRI or key == Attribute.CODE...
KeyError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/bgp/message/update/attribute/attributes.py/Attributes.sameValuesAs
236
def count_tied_groups(x, use_missing=False): """ Counts the number of tied values. Parameters ---------- x : sequence Sequence of data on which to counts the ties use_missing : bool, optional Whether to consider missing values as tied. Returns ------- count_tied_gro...
KeyError
dataset/ETHPy150Open scipy/scipy/scipy/stats/mstats_basic.py/count_tied_groups
237
def __init__(self, source, include_regex='^%include\s"([^"]+)"', max_nest_level=100, output=None): """ Create a new ``Includer`` object. :Parameters: source : file or str The source to be read and ex...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/grizzled/grizzled/file/includer.py/Includer.__init__
238
def _make_container_root(name): ''' Make the container root directory ''' path = _root(name) if os.path.exists(path): __context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL raise CommandExecutionError( 'Container {0} already exists'.format(name) ) el...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/_make_container_root
239
def _build_failed(dst, name): try: __context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL shutil.rmtree(dst) except __HOLE__ as exc: if exc.errno != errno.ENOENT: raise CommandExecutionError( 'Unable to cleanup container root dir {0}'.format(dst) ...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/_build_failed
240
def _ensure_systemd(version): ''' Raises an exception if the systemd version is not greater than the passed version. ''' try: version = int(version) except ValueError: raise CommandExecutionError('Invalid version \'{0}\''.format(version)) try: installed = _sd_version...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/_ensure_systemd
241
@_ensure_exists def pid(name): ''' Returns the PID of a container name Container name CLI Example: .. code-block:: bash salt myminion nspawn.pid arch1 ''' try: return int(info(name).get('PID')) except (TypeError, __HOLE__) as exc: raise CommandExecutio...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/pid
242
def bootstrap_container(name, dist=None, version=None): ''' Bootstrap a container from package servers, if dist is None the os the minion is running as will be created, otherwise the needed bootstrapping tools will need to be available on the host. CLI Example: .. code-block:: bash sa...
KeyError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/bootstrap_container
243
def bootstrap_salt(name, config=None, approve_key=True, install=True, pub_key=None, priv_key=None, bootstrap_url=None, force_install=False, unconditional_install=False,...
TypeError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/bootstrap_salt
244
def list_all(): ''' Lists all nspawn containers CLI Example: .. code-block:: bash salt myminion nspawn.list_all ''' ret = [] if _sd_version() >= 219: for line in _machinectl('list-images')['stdout'].splitlines(): try: ret.append(line.split()[0])...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/list_all
245
def list_running(): ''' Lists running nspawn containers .. note:: ``nspawn.list`` also works to list running containers CLI Example: .. code-block:: bash salt myminion nspawn.list_running salt myminion nspawn.list ''' ret = [] for line in _machinectl('list')[...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/list_running
246
@_ensure_exists def state(name): ''' Return state of container (running or stopped) CLI Example: .. code-block:: bash salt myminion nspawn.state <name> ''' try: cmd = 'show {0} --property=State'.format(name) return _machinectl(cmd, ignore_retcode=True)['stdout'].split(...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/state
247
def info(name, **kwargs): ''' Return info about a container .. note:: The container must be running for ``machinectl`` to gather information about it. If the container is stopped, then this function will start it. start : False If ``True``, then the container will be s...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/info
248
@_ensure_exists def remove(name, stop=False): ''' Remove the named container .. warning:: This function will remove all data associated with the container. It will not, however, remove the btrfs subvolumes created by pulling container images (:mod:`nspawn.pull_raw <salt.mod...
OSError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/remove
249
@_ensure_exists def copy_to(name, source, dest, overwrite=False, makedirs=False): ''' Copy a file from the host into a container name Container name source File to be copied to the container dest Destination on the container. Must be an absolute path. overwrite : Fals...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/copy_to
250
def _pull_image(pull_type, image, name, **kwargs): ''' Common logic for machinectl pull-* commands ''' _ensure_systemd(219) if exists(name): raise SaltInvocationError( 'Container \'{0}\' already exists'.format(name) ) if pull_type in ('raw', 'tar'): valid_kwar...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/modules/nspawn.py/_pull_image
251
def _password_cmd(self): if self.password: try: p = subprocess.Popen(["sshpass"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.communicate() except __HOLE__: raise errors.AnsibleError("to use ...
OSError
dataset/ETHPy150Open open-cloud/xos/xos/synchronizers/vcpe/steps/ansible_test/xos.py/Connection._password_cmd
252
def not_in_host_file(self, host): if 'USER' in os.environ: user_host_file = os.path.expandvars("~${USER}/.ssh/known_hosts") else: user_host_file = "~/.ssh/known_hosts" user_host_file = os.path.expanduser(user_host_file) host_file_list = [] host_fi...
IOError
dataset/ETHPy150Open open-cloud/xos/xos/synchronizers/vcpe/steps/ansible_test/xos.py/Connection.not_in_host_file
253
def load_template_source(template_name, template_dirs=None): for filepath in get_template_sources(template_name, template_dirs): try: return (open(filepath).read(), filepath) except __HOLE__: pass raise TemplateDoesNotExist, template_name
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/template/loaders/app_directories.py/load_template_source
254
def stash(self, storage, url): """Stores the uploaded file in a temporary storage location.""" result = {} if self.is_valid(): upload = self.cleaned_data['upload'] name = storage.save(upload.name, upload) result['filename'] = os.path.basename(name) ...
NotImplementedError
dataset/ETHPy150Open caktus/django-sticky-uploads/stickyuploads/forms.py/UploadForm.stash
255
def get_dtd_element(self, name): try: return getattr(self.dtd, identifier(name)) except __HOLE__: raise ValidationError("No element: %s" % (name,))
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/FlowMixin.get_dtd_element
256
def new_image(self, _imagefile, _alt=None, **kwargs): check_flag(kwargs, "ismap") if Image is not None: try: im = Image.open(_imagefile) except __HOLE__: pass else: x, y = im.size kwargs["width"] = str(x)...
IOError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/FlowMixin.new_image
257
def next_id(self, name): try: self._COUNTERS[name].next() return str(self._COUNTERS[name]) except __HOLE__: ctr = self._COUNTERS[name] = _Counter(name) return str(ctr) # helpers for adding specific elements
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/XHTMLDocument.next_id
258
def new_inline(self, _name, _obj, **attribs): _obj = create_POM(_obj, self.dtd) try: ilmc = getattr(self.dtd, _name) except __HOLE__: raise ValidationError("%s: not valid for this DTD." % (_name,)) Inline = get_class(self.dtd, "Inline%s" % (_name,), (InlineMixin, ...
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/InlineMixin.new_inline
259
def set_cell(self, col, row, val): val = check_object(val) for inter in range(row - len(self._t_rows)): newrow = self.dtd.Tr() self._t_rows.append(newrow) for inter in range(col): newrow.append(self.dtd.Td()) r = self._t_rows[row-1] wh...
IndexError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/TableMixin.set_cell
260
def _check_node(self, container, node): if isinstance(node, (self.dtd.Input, self.dtd.Select, self.dtd.Textarea)): try: l = container[node.name] except __HOLE__: l = container[node.name] = [] l.append(node) raise XMLVisitorContinue
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/XHTML.py/FormMixin._check_node
261
def warn(message, category=None, stacklevel=1): """Issue a warning, or maybe ignore it or raise an exception.""" # Check if message is already a Warning object if isinstance(message, Warning): category = message.__class__ # Check category argument if category is None: category = User...
AttributeError
dataset/ETHPy150Open babble/babble/include/jython/Lib/warnings.py/warn
262
def showwarning(message, category, filename, lineno, file=None): """Hook to write a warning to a file; replace if you like.""" if file is None: file = sys.stderr try: file.write(formatwarning(message, category, filename, lineno)) except __HOLE__: pass # the file (probably stderr)...
IOError
dataset/ETHPy150Open babble/babble/include/jython/Lib/warnings.py/showwarning
263
def _setoption(arg): import re parts = arg.split(':') if len(parts) > 5: raise _OptionError("too many fields (max 5): %r" % (arg,)) while len(parts) < 5: parts.append('') action, message, category, module, lineno = [s.strip() for s in ...
ValueError
dataset/ETHPy150Open babble/babble/include/jython/Lib/warnings.py/_setoption
264
def _getcategory(category): import re if not category: return Warning if re.match("^[a-zA-Z0-9_]+$", category): try: cat = eval(category) except __HOLE__: raise _OptionError("unknown warning category: %r" % (category,)) else: i = category.rfind("."...
NameError
dataset/ETHPy150Open babble/babble/include/jython/Lib/warnings.py/_getcategory
265
def test_len_cycles(self): N = 20 items = [RefCycle() for i in range(N)] s = WeakSet(items) del items it = iter(s) try: next(it) except __HOLE__: pass gc.collect() n1 = len(s) del it gc.collect() n2 =...
StopIteration
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_weakset.py/TestWeakSet.test_len_cycles
266
@unittest.skipIf(test_support.is_jython, "GarbageCollection not deterministic in Jython") def test_len_race(self): # Extended sanity checks for len() in the face of cyclic collection self.addCleanup(gc.set_threshold, *gc.get_threshold()) for th in range(1, 100): N = 20 ...
StopIteration
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_weakset.py/TestWeakSet.test_len_race
267
@classmethod def _hashable_item(cls, item): key, value = item try: hash(value) except __HOLE__: return key, cls._HASHABLE return key, value
TypeError
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/config.py/HashableFrozenDict._hashable_item
268
def flatten(obj): """ >>> list(flatten([1, 2])) [1, 2] >>> list(flatten([[1, [2, 3]], 4])) [1, 2, 3, 4] >>> list(flatten([xrange(1, 3), xrange(3, 5)])) [1, 2, 3, 4] >>> list(flatten(list)) [] """ queue = collections.deque([obj]) while queue: obj = queue.popleft...
TypeError
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/config.py/flatten
269
def load_configs(path, name="configs"): abspath = os.path.abspath(path) dirname, filename = os.path.split(abspath) sys_path = list(sys.path) argv_dir = os.path.dirname(os.path.abspath(sys.argv[0])) with _workdir(dirname): try: try: sys.path.remove(argv_dir) ...
ValueError
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/config.py/load_configs
270
def is_valid_ipv6_address(ip_str): """ Ensure we have a valid IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A boolean, True if this is a valid IPv6 address. """ from django.core.validators import validate_ipv4_address symbols_re = re.compile(r'^[0-9a-fA-...
ValueError
dataset/ETHPy150Open django/django/django/utils/ipv6.py/is_valid_ipv6_address
271
def thread_local_property(name): '''Creates a thread local ``property``.''' name = '_thread_local_' + name def fget(self): try: return getattr(self, name).value except __HOLE__: return None def fset(self, value): getattr(self, name).value = value re...
AttributeError
dataset/ETHPy150Open dossier/dossier.web/dossier/web/config.py/thread_local_property
272
def global_config(name): try: return yakonfig.get_global_config(name) except __HOLE__: return {}
KeyError
dataset/ETHPy150Open dossier/dossier.web/dossier/web/config.py/global_config
273
def _reference_list(cmd, references): """ Return a list of the values in the references mapping whose keys appear in the command Parameters ---------- cmd : string. A template command references : a mapping from tags to substitution objects Returns ------- A list of the unique valu...
KeyError
dataset/ETHPy150Open glue-viz/glue/glue/core/parse.py/_reference_list
274
def solveset(f, symbol=None, domain=S.Complexes): """Solves a given inequality or equation with set as output Parameters ========== f : Expr or a relational. The target equation or inequality symbol : Symbol The variable for which the equation is solved domain : Set The...
NotImplementedError
dataset/ETHPy150Open sympy/sympy/sympy/solvers/solveset.py/solveset
275
def linsolve(system, *symbols): r""" Solve system of N linear equations with M variables, which means both under - and overdetermined systems are supported. The possible number of solutions is zero, one or infinite. Zero solutions throws a ValueError, where as infinite solutions are represented ...
AttributeError
dataset/ETHPy150Open sympy/sympy/sympy/solvers/solveset.py/linsolve
276
def delete_shelf_tab(shelf_name, confirm=True): """The python version of the original mel script of Maya :param shelf_name: The name of the shelf to delete """ try: shelf_top_level_path = pm.melGlobals['gShelfTopLevel'] except KeyError: # not in GUI mode return shelf_top...
OSError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/delete_shelf_tab
277
def create_hud(self, hud_name): """creates HUD """ self.remove_hud(hud_name) try: # create our HUD pm.headsUpDisplay( hud_name, section=7, block=1, ao=1, blockSize="medium", ...
RuntimeError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/Playblaster.create_hud
278
def set_view_options(self): """set view options for playblast """ active_panel = self.get_active_panel() # turn all show/hide display options off except for polygons and # surfaces pm.modelEditor(active_panel, e=1, allObjects=False) pm.modelEditor(active_panel, e=...
RuntimeError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/Playblaster.set_view_options
279
def restore_user_options(self): """restores user options """ active_panel = self.get_active_panel() for flag, value in self.user_view_options['display_flags'].items(): pm.modelEditor(active_panel, **{'e': 1, flag: value}) # reassign original hud display options ...
RuntimeError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/Playblaster.restore_user_options
280
def playblast_simple(self, extra_playblast_options=None): """Does a simple playblast :param extra_playblast_options: A dictionary for extra playblast options. :return: A string showing the path of the resultant movie file """ playblast_options = copy.copy(self.global_p...
AttributeError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/Playblaster.playblast_simple
281
@classmethod def upload_output(cls, version, output_file_full_path): """sets the given file as the output of the given version, also generates a thumbnail and a web version if it is a movie file :param version: The stalker version instance :param output_file_full_path: the path of t...
IOError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/Playblaster.upload_output
282
def export_alembic_from_cache_node(handles=0, step=1): """exports alembic caches by looking at the current scene and try to find transform nodes which has an attribute called "cacheable" :param int handles: An integer that shows the desired handles from start and end. """ import os # get...
OSError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/export_alembic_from_cache_node
283
def unsetup(self): """deletes the barn door setup """ try: pm.delete(self.light.attr(self.message_storage_attr_name).inputs()) except __HOLE__: pass pm.scriptJob( k=int(self.light.getAttr(self.custom_data_storage_attr_name)) )
AttributeError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/BarnDoorSimulator.unsetup
284
def match_hierarchy(source, target): """Matches the objects in two different hierarchy by looking at their names. Returns a dictionary where you can look up for matches by using the object name. """ source_nodes = source.listRelatives( ad=1, type=(pm.nt.Mesh, pm.nt.NurbsSurface)...
ValueError
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/match_hierarchy
285
def occurrences_after(self, after=None): """ returns a generator that produces occurrences after the datetime ``after``. Includes all of the persisted Occurrences. """ if after is None: after = timezone.now() occ_replacer = OccurrenceReplacer(self.occurrence_...
StopIteration
dataset/ETHPy150Open llazzaro/django-scheduler/schedule/models/events.py/Event.occurrences_after
286
@property def effective_start(self): if self.pk and self.end_recurring_period: occ_generator = self._occurrences_after_generator(self.start) try: return next(occ_generator).start except __HOLE__: pass elif self.pk: retur...
StopIteration
dataset/ETHPy150Open llazzaro/django-scheduler/schedule/models/events.py/Event.effective_start
287
def build(master=None, initialcolor=None, initfile=None, ignore=None, dbfile=None): # create all output widgets s = Switchboard(not ignore and initfile) # defer to the command line chosen color database, falling back to the one # in the .pynche file. if dbfile is None: dbfile = s.o...
KeyError
dataset/ETHPy150Open francelabs/datafari/windows/python/Tools/pynche/Main.py/build
288
def run(app, s): try: app.start() except __HOLE__: pass
KeyboardInterrupt
dataset/ETHPy150Open francelabs/datafari/windows/python/Tools/pynche/Main.py/run
289
def __init__(self, apps): try: apps = apps.items() except __HOLE__: pass # Sort the apps by len(path), descending apps.sort() apps.reverse() # The path_prefix strings must start, but not end, with a slash. # Use "" instead...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/WSGIPathInfoDispatcher.__init__
290
def _parse_request(self): # HTTP/1.1 connections are persistent by default. If a client # requests a page, then idles (leaves the connection open), # then rfile.readline() will raise socket.error("timed out"). # Note that it does this based on the value given to settimeout(), # a...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/HTTPRequest._parse_request
291
def send_headers(self): """Assert, process, and send the HTTP response message-headers.""" hkeys = [key.lower() for key, value in self.outheaders] status = int(self.status[:3]) if status == 413: # Request Entity Too Large. Close conn to avoid garbage. sel...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/HTTPRequest.send_headers
292
def _safe_call(self, is_reader, call, *args, **kwargs): """Wrap the given call with SSL error-trapping. is_reader: if False EOF errors will be raised. If True, EOF errors will return "" (to emulate normal sockets). """ start = time.time() while True: ...
IndexError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/SSL_fileobject._safe_call
293
def communicate(self): """Read each request and respond appropriately.""" try: while True: # (re)set req to None so that if something goes wrong in # the RequestHandlerClass constructor, the error doesn't # get written to the previous request. ...
SystemExit
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/HTTPConnection.communicate
294
def run(self): try: self.ready = True while True: try: conn = self.server.requests.get() if conn is _SHUTDOWNREQUEST: return self.conn = conn try: ...
KeyboardInterrupt
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/WorkerThread.run
295
def stop(self, timeout=5): # Must shut down threads here so the code that calls # this method can know when all threads are stopped. for worker in self._threads: self._queue.put(_SHUTDOWNREQUEST) # Don't join currentThread (when stop is called inside a request). ...
AssertionError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/ThreadPool.stop
296
def bind_server(self): # We don't have to trap KeyboardInterrupt or SystemExit here, # because cherrpy.server already does so, calling self.stop() for us. # If you're using this server with another framework, you should # trap those exceptions in whatever code block calls start(). ...
IOError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/CherryPyWSGIServer.bind_server
297
def _bind(self, family, type, proto=0): """Create (or recreate) the actual socket object.""" self.socket = socket.socket(family, type, proto) prevent_socket_inheritance(self.socket) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if self.nodelay: sel...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/CherryPyWSGIServer._bind
298
def main(): r = "json" u = "changeme" p = "changeme" f = "marcuz" t = "44**********" msg = {'reqtype': r, 'api_secret': p, 'from': f, 'to': t, 'api_key': u} verify = copy.deepcopy(msg) try: if sys.argv[1] == 'verify': verify['number'] = sys.argv[2] ver...
IndexError
dataset/ETHPy150Open marcuz/libpynexmo/demos/simple/nexmo_verify.py/main
299
def __init__(self, tag_name, as_var, parent_expr, slot_expr, **kwargs): super(PagePlaceholderNode, self).__init__(tag_name, as_var, parent_expr, slot_expr, **kwargs) self.slot_expr = slot_expr # Move some arguments outside the regular "kwargs" # because they don't need to be parsed as v...
KeyError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/templatetags/fluent_contents_tags.py/PagePlaceholderNode.__init__