Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
3,800 | def _get_str(self):
global Save_Strings
if self.duplicate or self.is_derived():
return self.get_path()
srcnode = self.srcnode()
if srcnode.stat() is None and self.stat() is not None:
result = self.get_path()
else:
result = srcnode.get_path()
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base._get_str |
3,801 | def stat(self):
try: return self._memo['stat']
except __HOLE__: pass
try: result = self.fs.stat(self.abspath)
except os.error: result = None
self._memo['stat'] = result
return result | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.stat |
3,802 | def get_path(self, dir=None):
"""Return path relative to the current working directory of the
Node.FS.Base object that owns us."""
if not dir:
dir = self.fs.getcwd()
if self == dir:
return '.'
path_elems = self.path_elements
pathname = ''
t... | ValueError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.get_path |
3,803 | def src_builder(self):
"""Fetch the source code builder for this node.
If there isn't one, we cache the source code builder specified
for the directory (which in turn will cache the value from its
parent directory, and so on up to the file system root).
"""
try:
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.src_builder |
3,804 | def get_subst_proxy(self):
try:
return self._proxy
except __HOLE__:
ret = EntryProxy(self)
self._proxy = ret
return ret | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.get_subst_proxy |
3,805 | def Rfindalldirs(self, pathlist):
"""
Return all of the directories for a given path list, including
corresponding "backing" directories in any repositories.
The Node lookups are relative to this Node (typically a
directory), so memoizing result saves cycles from looking
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.Rfindalldirs |
3,806 | def rentry(self):
try:
return self._memo['rentry']
except KeyError:
pass
result = self
if not self.exists():
norm_name = _my_normcase(self.name)
for dir in self.dir.get_all_rdirs():
try:
node = dir.entrie... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Base.rentry |
3,807 | def chdir(self, dir, change_os_dir=0):
"""Change the current working directory for lookups.
If change_os_dir is true, we will also change the "real" cwd
to match.
"""
curr=self._cwd
try:
if dir is not None:
self._cwd = dir
if ch... | OSError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FS.chdir |
3,808 | def get_root(self, drive):
"""
Returns the root directory for the specified drive, creating
it if necessary.
"""
drive = _my_normcase(drive)
try:
return self.Root[drive]
except __HOLE__:
root = RootDir(drive, self)
self.Root[dri... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FS.get_root |
3,809 | def _lookup(self, p, directory, fsclass, create=1):
"""
The generic entry point for Node lookup with user-supplied data.
This translates arbitrary input into a canonical Node.FS object
of the specified fsclass. The general approach for strings is
to turn it into a fully normali... | IndexError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FS._lookup |
3,810 | def __clearRepositoryCache(self, duplicate=None):
"""Called when we change the repository(ies) for a directory.
This clears any cached information that is invalidated by changing
the repository."""
for node in self.entries.values():
if node != self.dir:
if no... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.__clearRepositoryCache |
3,811 | def get_all_rdirs(self):
try:
return list(self._memo['get_all_rdirs'])
except __HOLE__:
pass
result = [self]
fname = '.'
dir = self
while dir:
for rep in dir.getRepositories():
result.append(rep.Dir(fname))
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.get_all_rdirs |
3,812 | def rel_path(self, other):
"""Return a path to "other" relative to this directory.
"""
# This complicated and expensive method, which constructs relative
# paths between arbitrary Node.FS objects, is no longer used
# by SCons itself. It was introduced to store dependency paths
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.rel_path |
3,813 | def _create(self):
"""Create this directory, silently and without worrying about
whether the builder is the default or not."""
listDirs = []
parent = self
while parent:
if parent.exists():
break
listDirs.append(parent)
p = paren... | OSError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir._create |
3,814 | def rdir(self):
if not self.exists():
norm_name = _my_normcase(self.name)
for dir in self.dir.get_all_rdirs():
try: node = dir.entries[norm_name]
except __HOLE__: node = dir.dir_on_disk(self.name)
if node and node.exists() and \
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.rdir |
3,815 | def entry_exists_on_disk(self, name):
try:
d = self.on_disk_entries
except AttributeError:
d = {}
try:
entries = os.listdir(self.abspath)
except __HOLE__:
pass
else:
for entry in map(_my_normcase,... | OSError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.entry_exists_on_disk |
3,816 | def srcdir_list(self):
try:
return self._memo['srcdir_list']
except __HOLE__:
pass
result = []
dirname = '.'
dir = self
while dir:
if dir.srcdir:
result.append(dir.srcdir.Dir(dirname))
dirname = dir.name + ... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.srcdir_list |
3,817 | def srcdir_find_file(self, filename):
try:
memo_dict = self._memo['srcdir_find_file']
except KeyError:
memo_dict = {}
self._memo['srcdir_find_file'] = memo_dict
else:
try:
return memo_dict[filename]
except KeyError:
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.srcdir_find_file |
3,818 | def dir_on_disk(self, name):
if self.entry_exists_on_disk(name):
try: return self.Dir(name)
except __HOLE__: pass
node = self.srcdir_duplicate(name)
if isinstance(node, File):
return None
return node | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.dir_on_disk |
3,819 | def file_on_disk(self, name):
if self.entry_exists_on_disk(name) or \
diskcheck_rcs(self, name) or \
diskcheck_sccs(self, name):
try: return self.File(name)
except __HOLE__: pass
node = self.srcdir_duplicate(name)
if isinstance(node, Dir):
... | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/Dir.file_on_disk |
3,820 | def _lookup_abs(self, p, klass, create=1):
"""
Fast (?) lookup of a *normalized* absolute path.
This method is intended for use by internal lookups with
already-normalized path data. For general-purpose lookups,
use the FS.Entry(), FS.Dir() or FS.File() methods.
The ca... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/RootDir._lookup_abs |
3,821 | def convert_to_sconsign(self):
"""
Converts this FileBuildInfo object for writing to a .sconsign file
This replaces each Node in our various dependency lists with its
usual string representation: relative to the top-level SConstruct
directory, or an absolute path if it's outside... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FileBuildInfo.convert_to_sconsign |
3,822 | def prepare_dependencies(self):
"""
Prepares a FileBuildInfo object for explaining what changed
The bsources, bdepends and bimplicit lists have all been
stored on disk as paths relative to the top-level SConstruct
directory. Convert the strings to actual Nodes (for use by the
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FileBuildInfo.prepare_dependencies |
3,823 | def get_size(self):
try:
return self._memo['get_size']
except __HOLE__:
pass
if self.rexists():
size = self.rfile().getsize()
else:
size = 0
self._memo['get_size'] = size
return size | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_size |
3,824 | def get_timestamp(self):
try:
return self._memo['get_timestamp']
except __HOLE__:
pass
if self.rexists():
timestamp = self.rfile().getmtime()
else:
timestamp = 0
self._memo['get_timestamp'] = timestamp
return timestamp | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_timestamp |
3,825 | def convert_old_entry(self, old_entry):
# Convert a .sconsign entry from before the Big Signature
# Refactoring, doing what we can to convert its information
# to the new .sconsign entry format.
#
# The old format looked essentially like this:
#
# BuildInfo
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.convert_old_entry |
3,826 | def get_stored_info(self):
try:
return self._memo['get_stored_info']
except __HOLE__:
pass
try:
sconsign_entry = self.dir.sconsign().get_entry(self.name)
except (KeyError, EnvironmentError):
import SCons.SConsign
sconsign_entry... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_stored_info |
3,827 | def get_stored_implicit(self):
binfo = self.get_stored_info().binfo
binfo.prepare_dependencies()
try: return binfo.bimplicit
except __HOLE__: return None | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_stored_implicit |
3,828 | def get_found_includes(self, env, scanner, path):
"""Return the included implicit dependencies in this file.
Cache results so we only scan the file once per path
regardless of how many times this information is requested.
"""
memo_key = (id(env), id(scanner), path)
try:
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_found_includes |
3,829 | def find_src_builder(self):
if self.rexists():
return None
scb = self.dir.src_builder()
if scb is _null:
if diskcheck_sccs(self.dir, self.name):
scb = get_DefaultSCCSBuilder()
elif diskcheck_rcs(self.dir, self.name):
scb = get_D... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.find_src_builder |
3,830 | def has_src_builder(self):
"""Return whether this Node has a source builder or not.
If this Node doesn't have an explicit source code builder, this
is where we figure out, on the fly, if there's a transparent
source code builder for it.
Note that if we found a source builder, w... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.has_src_builder |
3,831 | def exists(self):
try:
return self._memo['exists']
except __HOLE__:
pass
# Duplicate from source path if we are set up to do this.
if self.duplicate and not self.is_derived() and not self.linked:
src = self.srcnode()
if src is not self:
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.exists |
3,832 | def get_max_drift_csig(self):
"""
Returns the content signature currently stored for this node
if it's been unmodified longer than the max_drift value, or the
max_drift value is 0. Returns None otherwise.
"""
old = self.get_stored_info()
mtime = self.get_timestam... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_max_drift_csig |
3,833 | def get_csig(self):
"""
Generate a node's content signature, the digested signature
of its content.
node - the node
cache - alternate node to use for the signature cache
returns - the content signature
"""
ninfo = self.get_ninfo()
try:
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_csig |
3,834 | def changed(self, node=None, allowcache=False):
"""
Returns if the node is up-to-date with respect to the BuildInfo
stored last time it was built.
For File nodes this is basically a wrapper around Node.changed(),
but we allow the return value to get cached after the reference
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.changed |
3,835 | def changed_content(self, target, prev_ni):
cur_csig = self.get_csig()
try:
return cur_csig != prev_ni.csig
except __HOLE__:
return 1 | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.changed_content |
3,836 | def changed_timestamp_then_content(self, target, prev_ni):
if not self.changed_timestamp_match(target, prev_ni):
try:
self.get_ninfo().csig = prev_ni.csig
except __HOLE__:
pass
return False
return self.changed_content(target, prev_ni) | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.changed_timestamp_then_content |
3,837 | def changed_timestamp_newer(self, target, prev_ni):
try:
return self.get_timestamp() > target.get_timestamp()
except __HOLE__:
return 1 | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.changed_timestamp_newer |
3,838 | def changed_timestamp_match(self, target, prev_ni):
try:
return self.get_timestamp() != prev_ni.timestamp
except __HOLE__:
return 1 | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.changed_timestamp_match |
3,839 | def rfile(self):
try:
return self._memo['rfile']
except KeyError:
pass
result = self
if not self.exists():
norm_name = _my_normcase(self.name)
for dir in self.dir.get_all_rdirs():
try: node = dir.entries[norm_name]
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.rfile |
3,840 | def get_cachedir_csig(self):
"""
Fetch a Node's content signature for purposes of computing
another Node's cachesig.
This is a wrapper around the normal get_csig() method that handles
the somewhat obscure case of using CacheDir with the -n option.
Any files that don't ex... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_cachedir_csig |
3,841 | def get_contents_sig(self):
"""
A helper method for get_cachedir_bsig.
It computes and returns the signature for this
node's contents.
"""
try:
return self.contentsig
except __HOLE__:
pass
executor = self.get_executor()
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_contents_sig |
3,842 | def get_cachedir_bsig(self):
"""
Return the signature for a cached file, including
its children.
It adds the path of the cached file to the cache signature,
because multiple targets built by the same action will all
have the same build signature, and we have to different... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/File.get_cachedir_bsig |
3,843 | def filedir_lookup(self, p, fd=None):
"""
A helper method for find_file() that looks up a directory for
a file we're trying to find. This only creates the Dir Node if
it exists on-disk, since if the directory doesn't exist we know
we won't find any files in it... :-)
I... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FileFinder.filedir_lookup |
3,844 | def find_file(self, filename, paths, verbose=None):
"""
find_file(str, [Dir()]) -> [nodes]
filename - a filename to find
paths - a list of directory path *nodes* to search in. Can be
represented as a list, a tuple, or a callable that is
called with no ar... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/FileFinder.find_file |
3,845 | def invalidate_node_memos(targets):
"""
Invalidate the memoized values of all Nodes (files or directories)
that are associated with the given entries. Has been added to
clear the cache of nodes affected by a direct execution of an
action (e.g. Delete/Copy/Chmod). Existing Node caches become
inc... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py/invalidate_node_memos |
3,846 | def render(self, request):
actual_render = getattr(self, 'render_%s' % request.method)
try:
return actual_render(request)
except __HOLE__ as e:
typical_message = 'No JSON object could be decoded'
if e.message == typical_message:
request.setResp... | ValueError | dataset/ETHPy150Open livenson/vcdm/src/vcdm/server/cdmi/cdmiresource.py/StorageResource.render |
3,847 | def configure_logger(loglevel=2, quiet=False, logdir=None):
"Creates the logger instance and adds handlers plus formatting."
logger = logging.getLogger()
# Set the loglevel.
if loglevel > 3:
loglevel = 3 # Cap at 3 to avoid index errors.
levels = [logging.ERROR, logging.WARN, logging.INFO,... | IOError | dataset/ETHPy150Open mikar/demimove/demimove/helpers.py/configure_logger |
3,848 | def splitpath(path):
try:
match = splitrx.match(path).groups()
if match[-1] is None:
match = match[:-1] + ("",)
return match
except __HOLE__:
pass | AttributeError | dataset/ETHPy150Open mikar/demimove/demimove/helpers.py/splitpath |
3,849 | def _get_system_username():
"""
Obtain name of current system user, which will be default connection user.
"""
import getpass
username = None
try:
username = getpass.getuser()
# getpass.getuser supported on both Unix and Windows systems.
# getpass.getuser may call pwd.getpwuid wh... | KeyError | dataset/ETHPy150Open fabric/fabric/fabric/state.py/_get_system_username |
3,850 | def _update_content(sender, instance, created=None, **kwargs):
"""
Re-save any content models referencing the just-modified
``FileUpload``.
We don't do anything special to the content model, we just re-save
it. If signals are in use, we assume that the content model has
incorporated ``render_up... | AttributeError | dataset/ETHPy150Open carljm/django-adminfiles/adminfiles/listeners.py/_update_content |
3,851 | def isint(int_str):
try:
int(int_str)
return True
except (TypeError, __HOLE__):
return False | ValueError | dataset/ETHPy150Open closeio/flask-mongorest/flask_mongorest/utils.py/isint |
3,852 | def worker_input_generator(self):
'''Call this on the worker processes: yields input.'''
while True:
try:
x = self.input_queue.get(timeout=_IDLE_TIMEOUT)
if x is None:
return
if self.input_index is not None:
... | IOError | dataset/ETHPy150Open gatoatigrado/vimap/vimap/real_worker_routine.py/WorkerRoutine.worker_input_generator |
3,853 | def safe_close_queue(self, name, queue):
self.debug("Closing queue {0}", name)
queue.close()
try:
self.debug("Joining thread for queue {0}", name)
try:
self.debug(
"Joining queue {name} (size {size}, full: {full})",
... | AssertionError | dataset/ETHPy150Open gatoatigrado/vimap/vimap/real_worker_routine.py/WorkerRoutine.safe_close_queue |
3,854 | def run(self, input_queue, output_queue):
'''
Takes ordered items from input_queue, lets `fcn` iterate over
those, and puts items yielded by `fcn` onto the output queue,
with their IDs.
'''
self.input_queue, self.output_queue = input_queue, output_queue
self.input... | TypeError | dataset/ETHPy150Open gatoatigrado/vimap/vimap/real_worker_routine.py/WorkerRoutine.run |
3,855 | def convert(self, value):
if value is None:
return None
try:
# Try to return the URL if it's a ``File``, falling back to the string
# itself if it's been overridden or is a default.
return getattr(value, 'url', value)
except __HOLE__:
... | ValueError | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/FileField.convert |
3,856 | def hydrate(self, bundle):
value = super(DateField, self).hydrate(bundle)
if value and not hasattr(value, 'year'):
try:
# Try to rip a date/datetime out of it.
value = make_aware(parse(value))
if hasattr(value, 'hour'):
va... | ValueError | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/DateField.hydrate |
3,857 | def hydrate(self, bundle):
value = super(DateTimeField, self).hydrate(bundle)
if value and not hasattr(value, 'year'):
try:
# Try to rip a date/datetime out of it.
value = make_aware(parse(value))
except __HOLE__:
pass
ret... | ValueError | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/DateTimeField.hydrate |
3,858 | def resource_from_uri(self, fk_resource, uri, request=None, related_obj=None, related_name=None):
"""
Given a URI is provided, the related resource is attempted to be
loaded based on the identifiers in the URI.
"""
try:
obj = fk_resource.get_via_uri(uri, request=reque... | ObjectDoesNotExist | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/RelatedField.resource_from_uri |
3,859 | def dehydrate(self, bundle):
foreign_obj = None
if isinstance(self.attribute, basestring):
attrs = self.attribute.split('__')
foreign_obj = bundle.obj
for attr in attrs:
previous_obj = foreign_obj
try:
foreign_obj ... | ObjectDoesNotExist | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/ToOneField.dehydrate |
3,860 | def dehydrate(self, bundle):
if not bundle.obj or not bundle.obj.pk:
if not self.null:
raise ApiFieldError("The model '%r' does not have a primary key and can not be used in a ToMany context." % bundle.obj)
return []
the_m2ms = None
previous_obj = bundle... | ObjectDoesNotExist | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/ToManyField.dehydrate |
3,861 | def to_time(self, s):
try:
dt = parse(s)
except __HOLE__, e:
raise ApiFieldError(str(e))
else:
return datetime.time(dt.hour, dt.minute, dt.second) | ValueError | dataset/ETHPy150Open hzlf/openbroadcast/website/apps/tastypie__/fields.py/TimeField.to_time |
3,862 | def label_for_value(self, value):
#key = self.rel.get_related_field().name
if isinstance(value, DBRef):
value = value.id
try:
obj = self.rel.to.objects().get(**{'pk': value})
return ' <strong>%s</strong>' % escape(Truncator(obj).words(14, truncate='...'))... | ValueError | dataset/ETHPy150Open jschrewe/django-mongoadmin/mongoadmin/widgets.py/ReferenceRawIdWidget.label_for_value |
3,863 | def __cmp__(self, other):
if isinstance(other,SessionId):
return cmp(self.id,other.id)
else:
try:
return cmp(hash(self.id),hash(other))
except __HOLE__:
return 1 | TypeError | dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/voodoo/sessions/session_id.py/SessionId.__cmp__ |
3,864 | @analytics_task()
def track_confirmed_account_on_hubspot(webuser):
vid = _get_user_hubspot_id(webuser)
if vid:
# Only track the property if the contact already exists.
try:
domain = webuser.domain_memberships[0].domain
except (__HOLE__, AttributeError):
domain = '... | IndexError | dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/analytics/tasks.py/track_confirmed_account_on_hubspot |
3,865 | def __getitem__(self, key):
try:
return self.__getattr__(key)
except __HOLE__:
raise KeyError | AttributeError | dataset/ETHPy150Open reviewboard/rbtools/rbtools/api/resource.py/ResourceDictField.__getitem__ |
3,866 | def __getitem__(self, key):
try:
return self.__getattr__(key)
except __HOLE__:
raise KeyError | AttributeError | dataset/ETHPy150Open reviewboard/rbtools/rbtools/api/resource.py/ItemResource.__getitem__ |
3,867 | def __getitem__(self, key):
payload = self._item_list[key]
# TODO: Should try and guess the url based on the parent url,
# and the id number if the self link doesn't exist.
try:
url = payload['links']['self']['href']
except __HOLE__:
url = ''
# W... | KeyError | dataset/ETHPy150Open reviewboard/rbtools/rbtools/api/resource.py/ListResource.__getitem__ |
3,868 | @request_method_decorator
def _get_template_request(self, url_template, values={}, **kwargs):
"""Generate an HttpRequest from a uri-template.
This will replace each '{variable}' in the template with the
value from kwargs['variable'], or if it does not exist, the
value from values['v... | KeyError | dataset/ETHPy150Open reviewboard/rbtools/rbtools/api/resource.py/RootResource._get_template_request |
3,869 | def lock(file, flags):
try:
fcntl.flock(_getfd(file), flags)
except __HOLE__, exc_value:
# IOError: [Errno 11] Resource temporarily unavailable
if exc_value[0] == 11:
raise LockException(LockException.LOCK_FAILED, exc_value[1])
else:
... | IOError | dataset/ETHPy150Open harryliu/edwin/edwinServer/site_packages/ConcurrentLogHandler084/portalocker.py/lock |
3,870 | def _get_from_cache(self, target_self, *args, **kwargs):
target_self_cls_name = reflection.get_class_name(target_self,
fully_qualified=False)
func_name = "%(module)s.%(class)s.%(func_name)s" % {
'module': target_self.__module__,
... | TypeError | dataset/ETHPy150Open openstack/neutron/neutron/common/utils.py/cache_method_results._get_from_cache |
3,871 | def ensure_dir(dir_path):
"""Ensure a directory with 755 permissions mode."""
try:
os.makedirs(dir_path, 0o755)
except __HOLE__ as e:
# If the directory already existed, don't raise the error.
if e.errno != errno.EEXIST:
raise | OSError | dataset/ETHPy150Open openstack/neutron/neutron/common/utils.py/ensure_dir |
3,872 | def cpu_count():
try:
return multiprocessing.cpu_count()
except __HOLE__:
return 1 | NotImplementedError | dataset/ETHPy150Open openstack/neutron/neutron/common/utils.py/cpu_count |
3,873 | def load_class_by_alias_or_classname(namespace, name):
"""Load class using stevedore alias or the class name
:param namespace: namespace where the alias is defined
:param name: alias or class name of the class to be loaded
:returns class if calls can be loaded
:raises ImportError if class cannot be ... | ValueError | dataset/ETHPy150Open openstack/neutron/neutron/common/utils.py/load_class_by_alias_or_classname |
3,874 | def convertIconToPNG(app_name, destination_path, desired_size):
'''Converts an application icns file to a png file, choosing the
representation closest to (but >= than if possible) the desired_size.
Returns True if successful, False otherwise'''
app_path = os.path.join('/Applications', app_name + '.app'... | AttributeError | dataset/ETHPy150Open munki/munki/code/apps/Managed Software Center/Managed Software Center/MunkiItems.py/convertIconToPNG |
3,875 | def __getitem__(self, name):
'''Allow access to instance variables and methods via dictionary syntax.
This allows us to use class instances as a data source
for our HTML templates (which want a dictionary-like object)'''
try:
return super(GenericItem, self).__getitem__(... | AttributeError | dataset/ETHPy150Open munki/munki/code/apps/Managed Software Center/Managed Software Center/MunkiItems.py/GenericItem.__getitem__ |
3,876 | def daemonize(self):
"""UNIX double-fork magic."""
try:
pid = os.fork()
if pid > 0:
# First parent; exit.
sys.exit(0)
except __HOLE__ as e:
sys.stderr.write('Could not fork! %d (%s)\n' %
(e.errno, e.... | OSError | dataset/ETHPy150Open sivy/pystatsd/pystatsd/daemon.py/Daemon.daemonize |
3,877 | def stop(self):
"""Stop the daemon."""
pid = None
if os.path.exists(self.pidfile):
with open(self.pidfile, 'r') as fp:
pid = int(fp.read().strip())
if not pid:
msg = 'pidfile (%s) does not exist. Daemon not running?\n'
sys.stderr.write... | OSError | dataset/ETHPy150Open sivy/pystatsd/pystatsd/daemon.py/Daemon.stop |
3,878 | def get_result(self, rs):
etags = []
key = name = None
newsource = None
if rs is not None:
try:
while True:
key = rs.next(self.conn.timeout())
getLogger().debug("got key {} with etag: {}".format(
... | StopIteration | dataset/ETHPy150Open longaccess/longaccess-client/lacli/pool.py/MPUpload.get_result |
3,879 | def _remove_finder(importer, finder):
"""Remove an existing finder from pkg_resources."""
existing_finder = _get_finder(importer)
if not existing_finder:
return
if isinstance(existing_finder, ChainedFinder):
try:
existing_finder.finders.remove(finder)
except __HOLE__:
return
if le... | ValueError | dataset/ETHPy150Open pantsbuild/pex/pex/finders.py/_remove_finder |
3,880 | def remove(self, event):
"""remove(event)
Removes the event from the event queue. The event is an Event object as
returned by the add or getevents methods."""
left = self.alarm(0)
try:
i = self.eventq.index(event)
except __HOLE__:
pass
else:
if... | ValueError | dataset/ETHPy150Open kdart/pycopia/core/pycopia/scheduler.py/Scheduler.remove |
3,881 | def get_scheduler():
global scheduler
try:
return scheduler
except __HOLE__:
scheduler = Scheduler()
return scheduler | NameError | dataset/ETHPy150Open kdart/pycopia/core/pycopia/scheduler.py/get_scheduler |
3,882 | def process_request(self, req):
path = req.args['path']
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
if repos is None or path != '/':
msg = u'No such repository (%s)\n' % path
self.log.warning(msg.rstrip('\n'))
... | KeyError | dataset/ETHPy150Open trac-hacks/trac-github/tracext/github.py/GitHubPostCommitHook.process_request |
3,883 | def childFactory(self, ctx, name):
"""Since we created anchor tags linking to children of this resource
directly by id, when the anchor is clicked, childFactory will be called
with the appropriate id as the name argument."""
try:
## Pass the id of the database item we want to... | ValueError | dataset/ETHPy150Open twisted/nevow/examples/db/db.py/DBBrowser.childFactory |
3,884 | def get_value(self, data):
try:
return data[self.name]
except __HOLE__:
raise MissingFieldValue(self.name) | KeyError | dataset/ETHPy150Open stepank/pyws/src/pyws/functions/args/field.py/Field.get_value |
3,885 | def validate(self, value):
try:
return self.type.validate(value, self.none_value)
except __HOLE__:
raise WrongFieldValueType(self.name) | ValueError | dataset/ETHPy150Open stepank/pyws/src/pyws/functions/args/field.py/Field.validate |
3,886 | def header_property(name, doc, transform=None):
"""Creates a header getter/setter.
Args:
name: Header name, e.g., "Content-Type"
doc: Docstring for the property
transform: Transformation function to use when setting the
property. The value will be passed to the function, and... | KeyError | dataset/ETHPy150Open falconry/falcon/falcon/response_helpers.py/header_property |
3,887 | def is_ascii_encodable(s):
"""Check if argument encodes to ascii without error."""
try:
s.encode('ascii')
except UnicodeEncodeError:
# NOTE(tbug): Py2 and Py3 will raise this if string contained
# chars that could not be ascii encoded
return False
except UnicodeDecodeErro... | AttributeError | dataset/ETHPy150Open falconry/falcon/falcon/response_helpers.py/is_ascii_encodable |
3,888 | def product_detail(request, object_id):
product = get_object_or_404(Product.objects.filter(is_active=True), pk=object_id)
if request.method == 'POST':
form = OrderItemForm(request.POST)
if form.is_valid():
order = shop.order_from_request(request, create=True)
try:
... | ValidationError | dataset/ETHPy150Open matthiask/plata/examples/simple/views.py/product_detail |
3,889 | def _encode_value(self, value):
if isinstance(value, str):
ret = '"' + value + '"'
elif isinstance(value, float):
ret = str(value) + 'f'
elif sys.version_info[0] >= 3 and isinstance(value, int):
if value > 2147483647:
ret = str(value) + 'l'
... | ValueError | dataset/ETHPy150Open mogui/pyorient/pyorient/serializations.py/OrientSerializationCSV._encode_value |
3,890 | def _parse_value( self, content ):
"""
Consume a field value.
:param: content str The input to consume
:return: list The collected value and any remaining content.
"""
c = ''
content = content.lstrip( " " )
try:
c = content[ 0 ] # st... | IndexError | dataset/ETHPy150Open mogui/pyorient/pyorient/serializations.py/OrientSerializationCSV._parse_value |
3,891 | @staticmethod
def _is_numeric( content ):
try:
float( content )
return True
except __HOLE__:
return False | ValueError | dataset/ETHPy150Open mogui/pyorient/pyorient/serializations.py/OrientSerializationCSV._is_numeric |
3,892 | def _parse_number(self, content):
"""
Consume a number.
If the number has a suffix, consume it also and instantiate the
right type, e.g. for dates
:param content str The content to consume
:return: list The collected number and any remaining content.
... | IndexError | dataset/ETHPy150Open mogui/pyorient/pyorient/serializations.py/OrientSerializationCSV._parse_number |
3,893 | def test_iterable(value):
"""Check if it's possible to iterate over an object."""
try:
iter(value)
except __HOLE__:
return False
return True | TypeError | dataset/ETHPy150Open GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/jinja2/tests.py/test_iterable |
3,894 | def inet_aton(text):
"""Convert a text format IPv6 address into network format.
@param text: the textual address
@type text: string
@rtype: string
@raises dns.exception.SyntaxError: the text was not properly formatted
"""
#
# Our aim here is not something fast; we just want something t... | TypeError | dataset/ETHPy150Open catap/namebench/nb_third_party/dns/ipv6.py/inet_aton |
3,895 | def request(self, operation, url, data=None, headers=None):
"""Performs an HTTP call to the server, supports GET, POST, PUT, and
DELETE.
Usage example, perform and HTTP GET on http://www.google.com/:
import atom.http
client = atom.http.HttpClient()
http_response = client.request('GET', '... | ValueError | dataset/ETHPy150Open kuri65536/python-for-android/python3-alpha/python-libs/atom/http.py/HttpClient.request |
3,896 | def __init__(self, path_spec, process_func=None, dtype=None,
as_grey=False, plugin=None):
try:
import skimage
except __HOLE__:
if plugin is not None:
warn("A plugin was specified but ignored. Plugins can only "
"be specified i... | ImportError | dataset/ETHPy150Open soft-matter/pims/pims/image_sequence.py/ImageSequence.__init__ |
3,897 | def __repr__(self):
# May be overwritten by subclasses
try:
source = self.pathname
except __HOLE__:
source = '(list of images)'
return """<Frames>
Source: {pathname}
Length: {count} frames
Frame Shape: {frame_shape!r}
Pixel Datatype: {dtype}""".format(frame_shape=... | AttributeError | dataset/ETHPy150Open soft-matter/pims/pims/image_sequence.py/ImageSequence.__repr__ |
3,898 | def filename_to_indices(filename, identifiers='tzc'):
""" Find ocurrences of axis indices (e.g. t001, z06, c2)
in a filename and returns a list of indices.
Parameters
----------
filename : string
filename to be searched for indices
identifiers : string or list of strings, optional
... | ValueError | dataset/ETHPy150Open soft-matter/pims/pims/image_sequence.py/filename_to_indices |
3,899 | def __repr__(self):
try:
source = self.pathname
except __HOLE__:
source = '(list of images)'
s = "<ImageSequenceND>\nSource: {0}\n".format(source)
s += "Axes: {0}\n".format(self.ndim)
for dim in self._sizes:
s += "Axis '{0}' size: {1}\n".format... | AttributeError | dataset/ETHPy150Open soft-matter/pims/pims/image_sequence.py/ImageSequenceND.__repr__ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.