code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def popen2(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen2
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def popen3(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen3
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def popen4(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen4
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def popen2(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen2
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def popen3(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen3
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def popen4(cmd, bufsize=-1, mode='t'): """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the she...
Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is ...
popen4
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/popen2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/popen2.py
MIT
def stat(self): """Get mailbox status. Result is tuple of 2 ints (message count, mailbox size) """ retval = self._shortcmd('STAT') rets = retval.split() if self._debugging: print '*stat*', repr(rets) numMessages = int(rets[1]) sizeMessages = int(rets[2]) ...
Get mailbox status. Result is tuple of 2 ints (message count, mailbox size)
stat
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/poplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/poplib.py
MIT
def list(self, which=None): """Request listing, return result. Result without a message number argument is in form ['response', ['mesg_num octets', ...], octets]. Result when a message number argument is given is a single response: the "scan listing" for that message. "...
Request listing, return result. Result without a message number argument is in form ['response', ['mesg_num octets', ...], octets]. Result when a message number argument is given is a single response: the "scan listing" for that message.
list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/poplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/poplib.py
MIT
def apop(self, user, secret): """Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; secret - secret shared between client and server. NB: mailbox is locked by server from here to 'quit()'...
Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; secret - secret shared between client and server. NB: mailbox is locked by server from here to 'quit()'
apop
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/poplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/poplib.py
MIT
def uidl(self, which=None): """Return message digest (unique id) list. If 'which', result contains unique id for that message in the form 'response mesgnum uid', otherwise result is the list ['response', ['mesgnum uid', ...], octets] """ if which is not None: ...
Return message digest (unique id) list. If 'which', result contains unique id for that message in the form 'response mesgnum uid', otherwise result is the list ['response', ['mesgnum uid', ...], octets]
uidl
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/poplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/poplib.py
MIT
def join(a, *p): """Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.""" path = a for b in p: if b.startswith('/'): ...
Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.
join
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def split(p): """Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.""" i = p.rfind('/') + 1 head, tail = p[:i], p[i:] if head and head != '/'*len(head): head = head.rstrip('/') return head, tail
Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.
split
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def dirname(p): """Returns the directory component of a pathname""" i = p.rfind('/') + 1 head = p[:i] if head and head != '/'*len(head): head = head.rstrip('/') return head
Returns the directory component of a pathname
dirname
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def islink(path): """Test whether a path is a symbolic link""" try: st = os.lstat(path) except (os.error, AttributeError): return False return stat.S_ISLNK(st.st_mode)
Test whether a path is a symbolic link
islink
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def lexists(path): """Test whether a path exists. Returns True for broken symbolic links""" try: os.lstat(path) except os.error: return False return True
Test whether a path exists. Returns True for broken symbolic links
lexists
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def samefile(f1, f2): """Test whether two pathnames reference the same actual file""" s1 = os.stat(f1) s2 = os.stat(f2) return samestat(s1, s2)
Test whether two pathnames reference the same actual file
samefile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def sameopenfile(fp1, fp2): """Test whether two open file objects reference the same file""" s1 = os.fstat(fp1) s2 = os.fstat(fp2) return samestat(s1, s2)
Test whether two open file objects reference the same file
sameopenfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def samestat(s1, s2): """Test whether two stat buffers reference the same file""" return s1.st_ino == s2.st_ino and \ s1.st_dev == s2.st_dev
Test whether two stat buffers reference the same file
samestat
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def ismount(path): """Test whether a path is a mount point""" if islink(path): # A symlink can never be a mount point return False try: s1 = os.lstat(path) s2 = os.lstat(join(path, '..')) except os.error: return False # It doesn't exist -- so not a mount point :-)...
Test whether a path is a mount point
ismount
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def walk(top, func, arg): """Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and ...
Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (exclud...
walk
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" if not path.startswith('~'): return path i = path.find('/', 1) if i < 0: i = len(path) if i == 1: if 'HOME' not in os.environ: import pwd userho...
Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.
expanduser
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def expandvars(path): """Expand shell variables of form $var and ${var}. Unknown variables are left unchanged.""" global _varprog, _uvarprog if '$' not in path: return path if isinstance(path, _unicode): if not _uvarprog: import re _uvarprog = re.compile(ur'\...
Expand shell variables of form $var and ${var}. Unknown variables are left unchanged.
expandvars
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def normpath(path): """Normalize path, eliminating double slashes, etc.""" # Preserve unicode (if path is unicode) slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.') if path == '': return dot initial_slashes = path.startswith('/') # POSIX allows one or two initial sl...
Normalize path, eliminating double slashes, etc.
normpath
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/posixpath.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/posixpath.py
MIT
def pprint(object, stream=None, indent=1, width=80, depth=None): """Pretty-print a Python object to a stream [default is sys.stdout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) printer.pprint(object)
Pretty-print a Python object to a stream [default is sys.stdout].
pprint
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pprint.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pprint.py
MIT
def run(statement, filename=None, sort=-1): """Run statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather prof...
Run statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather profiling statistics from the execution. If no file...
run
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/profile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/profile.py
MIT
def runctx(statement, globals, locals, filename=None, sort=-1): """Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run """ prof = Profile() try: prof = prof.runctx(state...
Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run
runctx
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/profile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/profile.py
MIT
def dump_stats(self, filename): """Write the profile data to a file we know how to load back.""" f = file(filename, 'wb') try: marshal.dump(self.stats, f) finally: f.close()
Write the profile data to a file we know how to load back.
dump_stats
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pstats.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pstats.py
MIT
def get_sort_arg_defs(self): """Expand all abbreviations that are unique.""" if not self.sort_arg_dict: self.sort_arg_dict = dict = {} bad_list = {} for word, tup in self.sort_arg_dict_default.iteritems(): fragment = word while fragment...
Expand all abbreviations that are unique.
get_sort_arg_defs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pstats.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pstats.py
MIT
def add_func_stats(target, source): """Add together all the stats for two profile entries.""" cc, nc, tt, ct, callers = source t_cc, t_nc, t_tt, t_ct, t_callers = target return (cc+t_cc, nc+t_nc, tt+t_tt, ct+t_ct, add_callers(t_callers, callers))
Add together all the stats for two profile entries.
add_func_stats
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pstats.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pstats.py
MIT
def add_callers(target, source): """Combine two caller lists in a single list.""" new_callers = {} for func, caller in target.iteritems(): new_callers[func] = caller for func, caller in source.iteritems(): if func in new_callers: if isinstance(caller, tuple): ...
Combine two caller lists in a single list.
add_callers
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pstats.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pstats.py
MIT
def count_calls(callers): """Sum the caller statistics to get total number of calls received.""" nc = 0 for calls in callers.itervalues(): nc += calls return nc
Sum the caller statistics to get total number of calls received.
count_calls
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pstats.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pstats.py
MIT
def openpty(): """openpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.""" try: return os.openpty() except (AttributeError, OSError): pass master_fd, slave_name = _open_terminal() slave_fd = slave_open(slave_name) return master_fd, ...
openpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.
openpty
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def master_open(): """master_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.""" try: master_fd, slave_fd = os.openpty() except (AttributeError, OSError): pass else: slave_name = ...
master_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.
master_open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def slave_open(tty_name): """slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.""" result = os.open(tty_name, os.O_RDWR) try: from fcntl import ioctl, I_PUSH except ImportError...
slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.
slave_open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def fork(): """fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.""" try: pid, fd = os.forkpty() except (AttributeError, OSError): pass else: if pid == CHILD: try: os.setsid() except OSErro...
fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.
fork
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def _writen(fd, data): """Write all the data to a descriptor.""" while data != '': n = os.write(fd, data) data = data[n:]
Write all the data to a descriptor.
_writen
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def _copy(master_fd, master_read=_read, stdin_read=_read): """Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)""" fds = [master_fd, STDIN_FILENO] while True: rfds, wfds, xfds = select(fds, [], []) ...
Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)
_copy
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pty.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pty.py
MIT
def readmodule(module, path=None): '''Backwards compatible interface. Call readmodule_ex() and then only keep Class objects from the resulting dictionary.''' res = {} for key, value in _readmodule(module, path or []).items(): if isinstance(value, Class): res[key] = value re...
Backwards compatible interface. Call readmodule_ex() and then only keep Class objects from the resulting dictionary.
readmodule
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pyclbr.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pyclbr.py
MIT
def _readmodule(module, path, inpackage=None): '''Do the hard work for readmodule[_ex]. If INPACKAGE is given, it must be the dotted name of the package in which we are searching for a submodule, and then PATH must be the package search path; otherwise, we are searching for a top-level module, and ...
Do the hard work for readmodule[_ex]. If INPACKAGE is given, it must be the dotted name of the package in which we are searching for a submodule, and then PATH must be the package search path; otherwise, we are searching for a top-level module, and PATH is combined with sys.path.
_readmodule
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pyclbr.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pyclbr.py
MIT
def pathdirs(): """Convert sys.path into a list of absolute, existing, unique paths.""" dirs = [] normdirs = [] for dir in sys.path: dir = os.path.abspath(dir or '.') normdir = os.path.normcase(dir) if normdir not in normdirs and os.path.isdir(dir): dirs.append(dir) ...
Convert sys.path into a list of absolute, existing, unique paths.
pathdirs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def getdoc(object): """Get the doc string or comments for an object.""" result = inspect.getdoc(object) or inspect.getcomments(object) result = _encode(result) return result and re.sub('^ *\n', '', rstrip(result)) or ''
Get the doc string or comments for an object.
getdoc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def splitdoc(doc): """Split a doc string into a synopsis line (if any) and the rest.""" lines = split(strip(doc), '\n') if len(lines) == 1: return lines[0], '' elif len(lines) >= 2 and not rstrip(lines[1]): return lines[0], join(lines[2:], '\n') return '', join(lines, '\n')
Split a doc string into a synopsis line (if any) and the rest.
splitdoc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def classname(object, modname): """Get a class name and qualify it with a module name if necessary.""" name = object.__name__ if object.__module__ != modname: name = object.__module__ + '.' + name return name
Get a class name and qualify it with a module name if necessary.
classname
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def isdata(object): """Check if an object is of a type that probably means it's data.""" return not (inspect.ismodule(object) or inspect.isclass(object) or inspect.isroutine(object) or inspect.isframe(object) or inspect.istraceback(object) or inspect.iscode(object))
Check if an object is of a type that probably means it's data.
isdata
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def replace(text, *pairs): """Do a series of global replacements on a string.""" while pairs: text = join(split(text, pairs[0]), pairs[1]) pairs = pairs[2:] return text
Do a series of global replacements on a string.
replace
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def stripid(text): """Remove the hexadecimal id from a Python object representation.""" # The behaviour of %p is implementation-dependent in terms of case. return _re_stripid.sub(r'\1', text)
Remove the hexadecimal id from a Python object representation.
stripid
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def _split_list(s, predicate): """Split sequence s via predicate, and return pair ([true], [false]). The return value is a 2-tuple of lists, ([x for x in s if predicate(x)], [x for x in s if not predicate(x)]) """ yes = [] no = [] for x in s: if predicate(x): ...
Split sequence s via predicate, and return pair ([true], [false]). The return value is a 2-tuple of lists, ([x for x in s if predicate(x)], [x for x in s if not predicate(x)])
_split_list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def visiblename(name, all=None, obj=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', '__module__', '__name__', '__slots__', '__package__') if name in _hidden_na...
Decide whether to show documentation on a variable.
visiblename
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def classify_class_attrs(object): """Wrap inspect.classify_class_attrs, with fixup for data descriptors.""" def fixup(data): name, kind, cls, value = data if inspect.isdatadescriptor(value): kind = 'data descriptor' return name, kind, cls, value return map(fixup, inspect....
Wrap inspect.classify_class_attrs, with fixup for data descriptors.
classify_class_attrs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def ispackage(path): """Guess whether a path refers to a package directory.""" if os.path.isdir(path): for ext in ('.py', '.pyc', '.pyo'): if os.path.isfile(os.path.join(path, '__init__' + ext)): return True return False
Guess whether a path refers to a package directory.
ispackage
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def synopsis(filename, cache={}): """Get the one-line summary out of a module file.""" mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (None, None)) if lastupdate is None or lastupdate < mtime: info = inspect.getmoduleinfo(filename) try: file = ope...
Get the one-line summary out of a module file.
synopsis
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def importfile(path): """Import a Python source file or compiled file given its path.""" magic = imp.get_magic() file = open(path, 'r') if file.read(len(magic)) == magic: kind = imp.PY_COMPILED else: kind = imp.PY_SOURCE file.close() filename = os.path.basename(path) name...
Import a Python source file or compiled file given its path.
importfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def safeimport(path, forceload=0, cache={}): """Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end...
Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at the...
safeimport
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def fail(self, object, name=None, *args): """Raise an exception for unimplemented types.""" message = "don't know how to document object%s of type %s" % ( name and ' ' + repr(name), type(object).__name__) raise TypeError, message
Raise an exception for unimplemented types.
fail
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def getdocloc(self, object): """Return the location of module docs or None""" try: file = inspect.getabsfile(object) except TypeError: file = '(built-in)' docloc = os.environ.get("PYTHONDOCS", "http://docs.python.org/library") ...
Return the location of module docs or None
getdocloc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def multicolumn(self, list, format, cols=4): """Format a list of items into a multi-column list.""" result = '' rows = (len(list)+cols-1)//cols for col in range(cols): result = result + '<td width="%d%%" valign=top>' % (100//cols) for i in range(rows*col, rows*col...
Format a list of items into a multi-column list.
multicolumn
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def namelink(self, name, *dicts): """Make a link for an identifier, given name-to-URL mappings.""" for dict in dicts: if name in dict: return '<a href="%s">%s</a>' % (dict[name], name) return name
Make a link for an identifier, given name-to-URL mappings.
namelink
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def modpkglink(self, data): """Make a link for a module or package to display in an index.""" name, path, ispackage, shadowed = data if shadowed: return self.grey(name) if path: url = '%s.%s.html' % (path, name) else: url = '%s.html' % name ...
Make a link for a module or package to display in an index.
modpkglink
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def markup(self, text, escape=None, funcs={}, classes={}, methods={}): """Mark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.""" escape = escape or self.escape results = [] here = 0 pattern = re.compi...
Mark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.
markup
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def formattree(self, tree, modname, parent=None): """Produce HTML for a class tree as given by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): c, bases = entry result = result + '<dt><font face="helvetica, arial">'...
Produce HTML for a class tree as given by inspect.getclasstree().
formattree
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docmodule(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name try: all = object.__all__ except AttributeError: all = None parts = split(name, '.') ...
Produce HTML documentation for a module object.
docmodule
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docclass(self, object, name=None, mod=None, funcs={}, classes={}, *ignored): """Produce HTML documentation for a class object.""" realname = object.__name__ name = name or realname bases = object.__bases__ contents = [] push = contents.append ...
Produce HTML documentation for a class object.
docclass
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name n...
Produce HTML documentation for a function or method object.
docroutine
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docother(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a data object.""" lhs = name and '<strong>%s</strong> = ' % name or '' return lhs + self.repr(object)
Produce HTML documentation for a data object.
docother
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def index(self, dir, shadowed=None): """Generate an HTML index for a directory of modules.""" modpkgs = [] if shadowed is None: shadowed = {} for importer, name, ispkg in pkgutil.iter_modules([dir]): modpkgs.append((name, '', ispkg, name in shadowed)) shadowed[nam...
Generate an HTML index for a directory of modules.
index
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def indent(self, text, prefix=' '): """Indent text by prepending a given prefix to each line.""" if not text: return '' lines = split(text, '\n') lines = map(lambda line, prefix=prefix: prefix + line, lines) if lines: lines[-1] = rstrip(lines[-1]) return join(lines, '\...
Indent text by prepending a given prefix to each line.
indent
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def formattree(self, tree, modname, parent=None, prefix=''): """Render in text a class tree as returned by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): c, bases = entry result = result + prefix + classname(c, mo...
Render in text a class tree as returned by inspect.getclasstree().
formattree
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop)) try: ...
Produce text documentation for a given module object.
docmodule
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docclass(self, object, name=None, mod=None, *ignored): """Produce text documentation for a given class object.""" realname = object.__name__ name = name or realname bases = object.__bases__ def makename(c, m=object.__module__): return classname(c, m) if ...
Produce text documentation for a given class object.
docclass
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docroutine(self, object, name=None, mod=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' skipdocs = 0 if inspect.ismethod(object): imclass = object.im_class ...
Produce text documentation for a function or method object.
docroutine
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr...
Produce text documentation for a data object.
docother
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def pager(text): """The first time this is called, determine what kind of pager to use.""" global pager pager = getpager() pager(text)
The first time this is called, determine what kind of pager to use.
pager
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def getpager(): """Decide what method to use for paging through text.""" if type(sys.stdout) is not types.FileType: return plainpager if not hasattr(sys.stdin, "isatty"): return plainpager if not sys.stdin.isatty() or not sys.stdout.isatty(): return plainpager if 'PAGER' in o...
Decide what method to use for paging through text.
getpager
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def pipepager(text, cmd): """Page through text by feeding it to another program.""" pipe = os.popen(cmd, 'w') try: pipe.write(_encode(text)) pipe.close() except IOError: pass # Ignore broken pipes caused by quitting the pager program.
Page through text by feeding it to another program.
pipepager
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def tempfilepager(text, cmd): """Page through text by invoking a program on a temporary file.""" import tempfile filename = tempfile.mktemp() file = open(filename, 'w') file.write(_encode(text)) file.close() try: os.system(cmd + ' "' + filename + '"') finally: os.unlink(f...
Page through text by invoking a program on a temporary file.
tempfilepager
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def ttypager(text): """Page through text on a text terminal.""" lines = plain(_encode(plain(text), getattr(sys.stdout, 'encoding', _encoding))).split('\n') try: import tty fd = sys.stdin.fileno() old = tty.tcgetattr(fd) tty.setcbreak(fd) getchar = lambda: sys.stdin.re...
Page through text on a text terminal.
ttypager
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def describe(thing): """Produce a short description of the given thing.""" if inspect.ismodule(thing): if thing.__name__ in sys.builtin_module_names: return 'built-in module ' + thing.__name__ if hasattr(thing, '__path__'): return 'package ' + thing.__name__ else:...
Produce a short description of the given thing.
describe
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def locate(path, forceload=0): """Locate an object by name or dotted path, importing as necessary.""" parts = [part for part in split(path, '.') if part] module, n = None, 0 while n < len(parts): nextmodule = safeimport(join(parts[:n+1], '.'), forceload) if nextmodule: module, n = nextmo...
Locate an object by name or dotted path, importing as necessary.
locate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def resolve(thing, forceload=0): """Given an object or a path to an object, get the object and its name.""" if isinstance(thing, str): object = locate(thing, forceload) if object is None: raise ImportError, 'no Python documentation found for %r' % thing return object, thing ...
Given an object or a path to an object, get the object and its name.
resolve
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def render_doc(thing, title='Python Library Documentation: %s', forceload=0): """Render text documentation, given an object or a path to an object.""" object, name = resolve(thing, forceload) desc = describe(object) module = inspect.getmodule(object) if name and '.' in name: desc += ' in ' +...
Render text documentation, given an object or a path to an object.
render_doc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def doc(thing, title='Python Library Documentation: %s', forceload=0): """Display text documentation, given an object or a path to an object.""" try: pager(render_doc(thing, title, forceload)) except (ImportError, ErrorDuringImport), value: print value
Display text documentation, given an object or a path to an object.
doc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def writedoc(thing, forceload=0): """Write HTML documentation to a file in the current directory.""" try: object, name = resolve(thing, forceload) page = html.page(describe(object), html.document(object, name)) file = open(name + '.html', 'w') file.write(page) file.close(...
Write HTML documentation to a file in the current directory.
writedoc
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def writedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" if done is None: done = {} for importer, modname, ispkg in pkgutil.walk_packages([dir], pkgpath): writedoc(modname) return
Write out HTML documentation for all modules in a directory tree.
writedocs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def getline(self, prompt): """Read one line, using raw_input when available.""" if self.input is sys.stdin: return raw_input(prompt) else: self.output.write(prompt) self.output.flush() return self.input.readline()
Read one line, using raw_input when available.
getline
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def apropos(key): """Print all the one-line module summaries that contain a substring.""" def callback(path, modname, desc): if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' print modname, desc and '- ' + desc def onerror(modname): pass with warni...
Print all the one-line module summaries that contain a substring.
apropos
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def gui(): """Graphical interface (starts web server and pops up a control window).""" class GUI: def __init__(self, window, port=7464): self.window = window self.server = None self.scanner = None import Tkinter self.server_frm = Tkinter.Frame...
Graphical interface (starts web server and pops up a control window).
gui
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def cli(): """Command-line interface (looks at sys.argv to decide what to do).""" import getopt class BadUsage: pass # Scripts don't get the current directory in their path by default # unless they are run with the '-m' switch if '' not in sys.path: scriptdir = os.path.dirname(sys.argv[...
Command-line interface (looks at sys.argv to decide what to do).
cli
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/pydoc.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/pydoc.py
MIT
def wr_long(f, x): """Internal; write a 32-bit int to a file in little-endian order.""" f.write(chr( x & 0xff)) f.write(chr((x >> 8) & 0xff)) f.write(chr((x >> 16) & 0xff)) f.write(chr((x >> 24) & 0xff))
Internal; write a 32-bit int to a file in little-endian order.
wr_long
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/py_compile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/py_compile.py
MIT
def compile(file, cfile=None, dfile=None, doraise=False): """Byte-compile one Python source file to Python bytecode. Arguments: file: source filename cfile: target filename; defaults to source with 'c' or 'o' appended ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo) df...
Byte-compile one Python source file to Python bytecode. Arguments: file: source filename cfile: target filename; defaults to source with 'c' or 'o' appended ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo) dfile: purported filename; defaults to source (this is the filena...
compile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/py_compile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/py_compile.py
MIT
def main(args=None): """Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles ...
Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicitly. ...
main
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/py_compile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/py_compile.py
MIT
def task_done(self): """Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it ...
Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items ...
task_done
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def join(self): """Blocks until all items in the Queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is ...
Blocks until all items in the Queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is complete. When the...
join
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def qsize(self): """Return the approximate size of the queue (not reliable!).""" self.mutex.acquire() n = self._qsize() self.mutex.release() return n
Return the approximate size of the queue (not reliable!).
qsize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def empty(self): """Return True if the queue is empty, False otherwise (not reliable!).""" self.mutex.acquire() n = not self._qsize() self.mutex.release() return n
Return True if the queue is empty, False otherwise (not reliable!).
empty
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def full(self): """Return True if the queue is full, False otherwise (not reliable!).""" self.mutex.acquire() n = 0 < self.maxsize == self._qsize() self.mutex.release() return n
Return True if the queue is full, False otherwise (not reliable!).
full
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def put(self, item, block=True, timeout=None): """Put an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until a free slot is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises ...
Put an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until a free slot is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Full exception if no free slot was available wit...
put
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def get(self, block=True, timeout=None): """Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until an item is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raise...
Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until an item is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Empty exception if no item was availab...
get
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/Queue.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/Queue.py
MIT
def needsquoting(c, quotetabs, header): """Decide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. """ if c in ' \t': return qu...
Decide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521.
needsquoting
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/quopri.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/quopri.py
MIT
def encode(input, output, quotetabs, header = 0): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs an...
Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. The...
encode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/quopri.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/quopri.py
MIT
def decode(input, output, header = 0): """Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. If 'header' is true, decode underscore as space (per RFC 1522).""" if a2b_qp is not None: data = input.read() ...
Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. If 'header' is true, decode underscore as space (per RFC 1522).
decode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/quopri.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/quopri.py
MIT