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 getmember(self, name):
"""Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
"""
tarinfo... | Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
| getmember | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def getmembers(self):
"""Return the members of the archive as a list of TarInfo objects. The
list has the same order as the members in the archive.
"""
self._check()
if not self._loaded: # if we want to obtain a list of
self._load() # all members, we firs... | Return the members of the archive as a list of TarInfo objects. The
list has the same order as the members in the archive.
| getmembers | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def gettarinfo(self, name=None, arcname=None, fileobj=None):
"""Create a TarInfo object from the result of os.stat or equivalent
on an existing file. The file is either named by `name', or
specified as a file object `fileobj' with a file descriptor. If
given, `arcname' specifies... | Create a TarInfo object from the result of os.stat or equivalent
on an existing file. The file is either named by `name', or
specified as a file object `fileobj' with a file descriptor. If
given, `arcname' specifies an alternative name for the file in the
archive, otherwise, ... | gettarinfo | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def list(self, verbose=True):
"""Print a table of contents to sys.stdout. If `verbose' is False, only
the names of the members are printed. If it is True, an `ls -l'-like
output is produced.
"""
self._check()
for tarinfo in self:
if verbose:
... | Print a table of contents to sys.stdout. If `verbose' is False, only
the names of the members are printed. If it is True, an `ls -l'-like
output is produced.
| list | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def add(self, name, arcname=None, recursive=True, exclude=None, filter=None):
"""Add the file `name' to the archive. `name' may be any type of file
(directory, fifo, symbolic link, etc.). If given, `arcname'
specifies an alternative name for the file in the archive.
Directories ... | Add the file `name' to the archive. `name' may be any type of file
(directory, fifo, symbolic link, etc.). If given, `arcname'
specifies an alternative name for the file in the archive.
Directories are added recursively by default. This can be avoided by
setting `recursive' t... | add | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def addfile(self, tarinfo, fileobj=None):
"""Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects directly, or by using gettarinfo().
On Windows platforms, `fileobj' s... | Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects directly, or by using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to a... | addfile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must... | Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmember... | extractall | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def extract(self, member, path=""):
"""Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. `member' may be a filename or a TarInfo object. You can
specify a different directory usin... | Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. `member' may be a filename or a TarInfo object. You can
specify a different directory using `path'.
| extract | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def extractfile(self, member):
"""Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file, a
file-like object is returned. If `member' is a link, a file-like
object is constructed from the link's target. I... | Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file, a
file-like object is returned. If `member' is a link, a file-like
object is constructed from the link's target. If `member' is none of
the above... | extractfile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _extract_member(self, tarinfo, targetpath):
"""Extract the TarInfo object tarinfo to a physical
file called targetpath.
"""
# Fetch the TarInfo object for the given name
# and build the destination pathname, replacing
# forward slashes to platform specific separato... | Extract the TarInfo object tarinfo to a physical
file called targetpath.
| _extract_member | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def makeunknown(self, tarinfo, targetpath):
"""Make a file from a TarInfo object with an unknown type
at targetpath.
"""
self.makefile(tarinfo, targetpath)
self._dbg(1, "tarfile: Unknown file type %r, " \
"extracted as regular file." % tarinfo.type) | Make a file from a TarInfo object with an unknown type
at targetpath.
| makeunknown | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def makedev(self, tarinfo, targetpath):
"""Make a character or block device called targetpath.
"""
if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
raise ExtractError("special devices not supported by system")
mode = tarinfo.mode
if tarinfo.isblk():
... | Make a character or block device called targetpath.
| makedev | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def chown(self, tarinfo, targetpath):
"""Set owner of targetpath according to tarinfo.
"""
if pwd and hasattr(os, "geteuid") and os.geteuid() == 0:
# We have to be root to do so.
try:
g = grp.getgrnam(tarinfo.gname)[2]
except KeyError:
... | Set owner of targetpath according to tarinfo.
| chown | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def chmod(self, tarinfo, targetpath):
"""Set file permissions of targetpath according to tarinfo.
"""
if hasattr(os, 'chmod'):
try:
os.chmod(targetpath, tarinfo.mode)
except EnvironmentError, e:
raise ExtractError("could not change mode") | Set file permissions of targetpath according to tarinfo.
| chmod | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def utime(self, tarinfo, targetpath):
"""Set modification time of targetpath according to tarinfo.
"""
if not hasattr(os, 'utime'):
return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
except EnvironmentError, e:
raise ExtractError(... | Set modification time of targetpath according to tarinfo.
| utime | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def next(self):
"""Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.
"""
self._check("ra")
if self.firstmember is not None:
m = self.firstmember
self.firs... | Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.
| next | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _getmember(self, name, tarinfo=None, normalize=False):
"""Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point.
"""
# Ensure that all members have been loaded.
members = self.getmembers()
# Limit the member searc... | Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point.
| _getmember | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _load(self):
"""Read through the entire archive file and look for readable
members.
"""
while True:
tarinfo = self.next()
if tarinfo is None:
break
self._loaded = True | Read through the entire archive file and look for readable
members.
| _load | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _check(self, mode=None):
"""Check if TarFile is still open, and if the operation's mode
corresponds to TarFile's mode.
"""
if self.closed:
raise IOError("%s is closed" % self.__class__.__name__)
if mode is not None and self.mode not in mode:
raise I... | Check if TarFile is still open, and if the operation's mode
corresponds to TarFile's mode.
| _check | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _find_link_target(self, tarinfo):
"""Find the target member of a symlink or hardlink member in the
archive.
"""
if tarinfo.issym():
# Always search the entire archive.
linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
... | Find the target member of a symlink or hardlink member in the
archive.
| _find_link_target | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _dbg(self, level, msg):
"""Write debugging output to sys.stderr.
"""
if level <= self.debug:
print >> sys.stderr, msg | Write debugging output to sys.stderr.
| _dbg | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def next(self):
"""Return the next item using TarFile's next() method.
When all members have been read, set TarFile as _loaded.
"""
# Fix for SF #1100429: Under rare circumstances it can
# happen that getmembers() is called during iteration,
# which will cause TarIter ... | Return the next item using TarFile's next() method.
When all members have been read, set TarFile as _loaded.
| next | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def is_tarfile(name):
"""Return True if name points to a tar archive that we
are able to handle, else return False.
"""
try:
t = open(name)
t.close()
return True
except TarError:
return False | Return True if name points to a tar archive that we
are able to handle, else return False.
| is_tarfile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def __init__(self, host=None, port=0,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Constructor.
When called without arguments, create an unconnected instance.
With a hostname argument, it connects the instance; port number
and timeout are optional.
"""
se... | Constructor.
When called without arguments, create an unconnected instance.
With a hostname argument, it connects the instance; port number
and timeout are optional.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance.
"""
self.eof = 0
if n... | Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance.
| open | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def msg(self, msg, *args):
"""Print a debug message, when the debug level is > 0.
If extra arguments are present, they are substituted in the
message using the standard string formatting operator.
"""
if self.debuglevel > 0:
print 'Telnet(%s,%s):' % (self.host, self... | Print a debug message, when the debug level is > 0.
If extra arguments are present, they are substituted in the
message using the standard string formatting operator.
| msg | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def write(self, buffer):
"""Write a string to the socket, doubling any IAC characters.
Can block if the connection is blocked. May raise
socket.error if the connection is closed.
"""
if IAC in buffer:
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %r"... | Write a string to the socket, doubling any IAC characters.
Can block if the connection is blocked. May raise
socket.error if the connection is closed.
| write | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_until(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
When no match is found, return whatever is available instead,
possibly the empty string. Raise EOFError if the connection
is closed and no cooked data is available.
"""
... | Read until a given string is encountered or until timeout.
When no match is found, return whatever is available instead,
possibly the empty string. Raise EOFError if the connection
is closed and no cooked data is available.
| read_until | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _read_until_with_poll(self, match, timeout):
"""Read until a given string is encountered or until timeout.
This method uses select.poll() to implement the timeout.
"""
n = len(match)
call_timeout = timeout
if timeout is not None:
from time import time
... | Read until a given string is encountered or until timeout.
This method uses select.poll() to implement the timeout.
| _read_until_with_poll | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _read_until_with_select(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = ... | Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
| _read_until_with_select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_all(self):
"""Read all data until EOF; block until connection closed."""
self.process_rawq()
while not self.eof:
self.fill_rawq()
self.process_rawq()
buf = self.cookedq
self.cookedq = ''
return buf | Read all data until EOF; block until connection closed. | read_all | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_some(self):
"""Read at least one byte of cooked data unless EOF is hit.
Return '' if EOF is hit. Block if no data is immediately
available.
"""
self.process_rawq()
while not self.cookedq and not self.eof:
self.fill_rawq()
self.process_r... | Read at least one byte of cooked data unless EOF is hit.
Return '' if EOF is hit. Block if no data is immediately
available.
| read_some | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_very_eager(self):
"""Read everything that's possible without blocking in I/O (eager).
Raise EOFError if connection closed and no cooked data
available. Return '' if no cooked data available otherwise.
Don't block unless in the midst of an IAC sequence.
"""
sel... | Read everything that's possible without blocking in I/O (eager).
Raise EOFError if connection closed and no cooked data
available. Return '' if no cooked data available otherwise.
Don't block unless in the midst of an IAC sequence.
| read_very_eager | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_eager(self):
"""Read readily available data.
Raise EOFError if connection closed and no cooked data
available. Return '' if no cooked data available otherwise.
Don't block unless in the midst of an IAC sequence.
"""
self.process_rawq()
while not self.c... | Read readily available data.
Raise EOFError if connection closed and no cooked data
available. Return '' if no cooked data available otherwise.
Don't block unless in the midst of an IAC sequence.
| read_eager | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_very_lazy(self):
"""Return any data available in the cooked queue (very lazy).
Raise EOFError if connection closed and no data available.
Return '' if no cooked data available otherwise. Don't block.
"""
buf = self.cookedq
self.cookedq = ''
if not buf ... | Return any data available in the cooked queue (very lazy).
Raise EOFError if connection closed and no data available.
Return '' if no cooked data available otherwise. Don't block.
| read_very_lazy | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def read_sb_data(self):
"""Return any data available in the SB ... SE queue.
Return '' if no SB ... SE available. Should only be called
after seeing a SB or SE command. When a new SB command is
found, old unread SB data will be discarded. Don't block.
"""
buf = self.sbd... | Return any data available in the SB ... SE queue.
Return '' if no SB ... SE available. Should only be called
after seeing a SB or SE command. When a new SB command is
found, old unread SB data will be discarded. Don't block.
| read_sb_data | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def process_rawq(self):
"""Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence.
"""
buf = ['', '']
try:
while self.rawq:
c = self.rawq_getchar()
... | Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence.
| process_rawq | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def rawq_getchar(self):
"""Get next char from raw queue.
Block if no data is immediately available. Raise EOFError
when connection is closed.
"""
if not self.rawq:
self.fill_rawq()
if self.eof:
raise EOFError
c = self.rawq[self.i... | Get next char from raw queue.
Block if no data is immediately available. Raise EOFError
when connection is closed.
| rawq_getchar | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def fill_rawq(self):
"""Fill raw queue from exactly one recv() system call.
Block if no data is immediately available. Set self.eof when
connection is closed.
"""
if self.irawq >= len(self.rawq):
self.rawq = ''
self.irawq = 0
# The buffer size s... | Fill raw queue from exactly one recv() system call.
Block if no data is immediately available. Set self.eof when
connection is closed.
| fill_rawq | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def interact(self):
"""Interaction function, emulates a very dumb telnet client."""
if sys.platform == "win32":
self.mt_interact()
return
while 1:
rfd, wfd, xfd = select.select([self, sys.stdin], [], [])
if self in rfd:
try:
... | Interaction function, emulates a very dumb telnet client. | interact | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def listener(self):
"""Helper for mt_interact() -- this executes in the other thread."""
while 1:
try:
data = self.read_eager()
except EOFError:
print '*** Connection closed by remote host ***'
return
if data:
... | Helper for mt_interact() -- this executes in the other thread. | listener | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def expect(self, list, timeout=None):
"""Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either
compiled (re.RegexObject instances) or uncompiled (strings).
The optional second argument is a timeout, in seconds; default
... | Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either
compiled (re.RegexObject instances) or uncompiled (strings).
The optional second argument is a timeout, in seconds; default
is no timeout.
Return a tuple of ... | expect | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _expect_with_poll(self, expect_list, timeout=None):
"""Read until one from a list of a regular expressions matches.
This method uses select.poll() to implement the timeout.
"""
re = None
expect_list = expect_list[:]
indices = range(len(expect_list))
for i in ... | Read until one from a list of a regular expressions matches.
This method uses select.poll() to implement the timeout.
| _expect_with_poll | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _expect_with_select(self, list, timeout=None):
"""Read until one from a list of a regular expressions matches.
The timeout is implemented using select.select().
"""
re = None
list = list[:]
indices = range(len(list))
for i in indices:
if not hasat... | Read until one from a list of a regular expressions matches.
The timeout is implemented using select.select().
| _expect_with_select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def test():
"""Test program for telnetlib.
Usage: python telnetlib.py [-d] ... [host [port]]
Default host is localhost; default port is 23.
"""
debuglevel = 0
while sys.argv[1:] and sys.argv[1] == '-d':
debuglevel = debuglevel+1
del sys.argv[1]
host = 'localhost'
if sy... | Test program for telnetlib.
Usage: python telnetlib.py [-d] ... [host [port]]
Default host is localhost; default port is 23.
| test | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which
_get_default_tempdir will try."""
dirlist = []
# First, try the environment.
for envname in 'TMPDIR', 'TEMP', 'TMP':
dirname = _os.getenv(envname)
if dirname: dirlist.append(dirname)
# F... | Generate a list of candidate temporary directories which
_get_default_tempdir will try. | _candidate_tempdir_list | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def _get_default_tempdir():
"""Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is delet... | Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is deleted. To prevent denial of
servi... | _get_default_tempdir | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def _get_candidate_names():
"""Common setup sequence for all user-callable interfaces."""
global _name_sequence
if _name_sequence is None:
_once_lock.acquire()
try:
if _name_sequence is None:
_name_sequence = _RandomNameSequence()
finally:
_on... | Common setup sequence for all user-callable interfaces. | _get_candidate_names | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def _mkstemp_inner(dir, pre, suf, flags):
"""Code common to mkstemp, TemporaryFile, and NamedTemporaryFile."""
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, pre + name + suf)
try:
fd = _os.open(file, flags, 0600... | Code common to mkstemp, TemporaryFile, and NamedTemporaryFile. | _mkstemp_inner | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def mkstemp(suffix="", prefix=template, dir=None, text=False):
"""User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
If 'suffix' is specified, the file name will end w... | User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
If 'suffix' is specified, the file name will end with that suffix,
otherwise there will be no suffix.
If 'prefi... | mkstemp | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def mkdtemp(suffix="", prefix=template, dir=None):
"""User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, an... | User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is... | mkdtemp | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def mktemp(suffix="", prefix=template, dir=None):
"""User-callable function to return a unique temporary file name. The
file is not created.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
This function is unsafe and should not be used. The file name
refers to ... | User-callable function to return a unique temporary file name. The
file is not created.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
This function is unsafe and should not be used. The file name
refers to a file that did not exist at some point, but by the time
... | mktemp | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer s... | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is crea... | NamedTemporaryFile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def TemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer ... | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
The file is created as mkstemp() would do it.
Returns an... | TemporaryFile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def _munge_whitespace(self, text):
"""_munge_whitespace(text : string) -> string
Munge whitespace in text: expand tabs and convert all other
whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
becomes " foo bar baz".
"""
if self.expand_tabs:
text ... | _munge_whitespace(text : string) -> string
Munge whitespace in text: expand tabs and convert all other
whitespace characters to spaces. Eg. " foo\tbar\n\nbaz"
becomes " foo bar baz".
| _munge_whitespace | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def _split(self, text):
"""_split(text : string) -> [string]
Split the text to wrap into indivisible chunks. Chunks are
not quite the same as words; see _wrap_chunks() for full
details. As an example, the text
Look, goof-ball -- use the -b option!
breaks into the fol... | _split(text : string) -> [string]
Split the text to wrap into indivisible chunks. Chunks are
not quite the same as words; see _wrap_chunks() for full
details. As an example, the text
Look, goof-ball -- use the -b option!
breaks into the following chunks:
'Look,', '... | _split | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def _fix_sentence_endings(self, chunks):
"""_fix_sentence_endings(chunks : [string])
Correct for sentence endings buried in 'chunks'. Eg. when the
original text contains "... foo.\\nBar ...", munge_whitespace()
and split() will convert that to [..., "foo.", " ", "Bar", ...]
whi... | _fix_sentence_endings(chunks : [string])
Correct for sentence endings buried in 'chunks'. Eg. when the
original text contains "... foo.\nBar ...", munge_whitespace()
and split() will convert that to [..., "foo.", " ", "Bar", ...]
which has one too few spaces; this method simply changes... | _fix_sentence_endings | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
"""_handle_long_word(chunks : [string],
cur_line : [string],
cur_len : int, width : int)
Handle a chunk of text (most likely a word, not whitespace) that
is too long... | _handle_long_word(chunks : [string],
cur_line : [string],
cur_len : int, width : int)
Handle a chunk of text (most likely a word, not whitespace) that
is too long to fit in any line.
| _handle_long_word | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def _wrap_chunks(self, chunks):
"""_wrap_chunks(chunks : [string]) -> [string]
Wrap a sequence of text chunks and return a list of lines of
length 'self.width' or less. (If 'break_long_words' is false,
some lines may be longer than this.) Chunks correspond roughly
to words and... | _wrap_chunks(chunks : [string]) -> [string]
Wrap a sequence of text chunks and return a list of lines of
length 'self.width' or less. (If 'break_long_words' is false,
some lines may be longer than this.) Chunks correspond roughly
to words and the whitespace between them: each chunk is... | _wrap_chunks | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def wrap(self, text):
"""wrap(text : string) -> [string]
Reformat the single paragraph in 'text' so it fits in lines of
no more than 'self.width' columns, and return a list of wrapped
lines. Tabs in 'text' are expanded with string.expandtabs(),
and all other whitespace characte... | wrap(text : string) -> [string]
Reformat the single paragraph in 'text' so it fits in lines of
no more than 'self.width' columns, and return a list of wrapped
lines. Tabs in 'text' are expanded with string.expandtabs(),
and all other whitespace characters (including newline) are
... | wrap | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def dedent(text):
"""Remove any common leading whitespace from every line in `text`.
This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.
Note that tabs and spaces are both treated as whitespace, ... | Remove any common leading whitespace from every line in `text`.
This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.
Note that tabs and spaces are both treated as whitespace, but they
are not equa... | dedent | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/textwrap.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/textwrap.py | MIT |
def setprofile(func):
"""Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
"""
global _profile_hook
_profile_hook = func | Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
| setprofile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def settrace(func):
"""Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
"""
global _trace_hook
_trace_hook = func | Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
| settrace | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def acquire(self, blocking=1):
"""Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. O... | Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. Once
the lock is unlocked (not owne... | acquire | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def release(self):
"""Release a lock, decrementing the recursion level.
If after the decrement it is zero, reset the lock to unlocked (not owned
by any thread), and if any other threads are blocked waiting for the
lock to become unlocked, allow exactly one of them to proceed. If after
... | Release a lock, decrementing the recursion level.
If after the decrement it is zero, reset the lock to unlocked (not owned
by any thread), and if any other threads are blocked waiting for the
lock to become unlocked, allow exactly one of them to proceed. If after
the decrement the recur... | release | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def wait(self, timeout=None):
"""Wait until notified or until a timeout occurs.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method releases the underlying lock, and then blocks until it is
awakened by a notify() or ... | Wait until notified or until a timeout occurs.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method releases the underlying lock, and then blocks until it is
awakened by a notify() or notifyAll() call for the same condition
... | wait | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def notify(self, n=1):
"""Wake up one or more threads waiting on this condition, if any.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method wakes up at most n of the threads waiting for the condition
variable; it is... | Wake up one or more threads waiting on this condition, if any.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method wakes up at most n of the threads waiting for the condition
variable; it is a no-op if no threads are waiting... | notify | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def acquire(self, blocking=1):
"""Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thre... | Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thread has called release() to
make it... | acquire | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def release(self):
"""Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
"""
with self.__cond:
self.__value = self.__value + 1
... | Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
| release | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def release(self):
"""Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
If the number of releases exceeds the number of acquires,
raise a V... | Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
If the number of releases exceeds the number of acquires,
raise a ValueError.
| release | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def set(self):
"""Set the internal flag to true.
All threads waiting for the flag to become true are awakened. Threads
that call wait() once the flag is true will not block at all.
"""
with self.__cond:
self.__flag = True
self.__cond.notify_all() | Set the internal flag to true.
All threads waiting for the flag to become true are awakened. Threads
that call wait() once the flag is true will not block at all.
| set | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def clear(self):
"""Reset the internal flag to false.
Subsequently, threads calling wait() will block until set() is called to
set the internal flag to true again.
"""
with self.__cond:
self.__flag = False | Reset the internal flag to false.
Subsequently, threads calling wait() will block until set() is called to
set the internal flag to true again.
| clear | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def wait(self, timeout=None):
"""Block until the internal flag is true.
If the internal flag is true on entry, return immediately. Otherwise,
block until another thread calls set() to set the flag to true, or until
the optional timeout occurs.
When the timeout argument is prese... | Block until the internal flag is true.
If the internal flag is true on entry, return immediately. Otherwise,
block until another thread calls set() to set the flag to true, or until
the optional timeout occurs.
When the timeout argument is present and not None, it should be a
f... | wait | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def __init__(self, group=None, target=None, name=None,
args=(), kwargs=None, verbose=None):
"""This constructor should always be called with keyword arguments. Arguments are:
*group* should be None; reserved for future extension when a ThreadGroup
class is implemented.
... | This constructor should always be called with keyword arguments. Arguments are:
*group* should be None; reserved for future extension when a ThreadGroup
class is implemented.
*target* is the callable object to be invoked by the run()
method. Defaults to None, meaning nothing is called.... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def start(self):
"""Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the
same thread object.
... | Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the
same thread object.
| start | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def run(self):
"""Method representing the thread's activity.
You may override this method in a subclass. The standard run() method
invokes the callable object passed to the object's constructor as the
target argument, if any, with sequential and keyword arguments taken
from the ... | Method representing the thread's activity.
You may override this method in a subclass. The standard run() method
invokes the callable object passed to the object's constructor as the
target argument, if any, with sequential and keyword arguments taken
from the args and kwargs arguments,... | run | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def __delete(self):
"Remove current thread from the dict of currently running threads."
# Notes about running with dummy_thread:
#
# Must take care to not raise an exception if dummy_thread is being
# used (and thus this module is being used as an instance of
# dummy_thr... | Remove current thread from the dict of currently running threads. | __delete | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def join(self, timeout=None):
"""Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is
called terminates -- either normally or through an unhandled exception
or until the optional timeout occurs.
When the timeout argument is pr... | Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is
called terminates -- either normally or through an unhandled exception
or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a
... | join | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def isAlive(self):
"""Return whether the thread is alive.
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
"""
assert self.__initialized, "Thre... | Return whether the thread is alive.
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
| isAlive | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def activeCount():
"""Return the number of Thread objects currently alive.
The returned count is equal to the length of the list returned by
enumerate().
"""
with _active_limbo_lock:
return len(_active) + len(_limbo) | Return the number of Thread objects currently alive.
The returned count is equal to the length of the list returned by
enumerate().
| activeCount | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def enumerate():
"""Return a list of all Thread objects currently alive.
The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.
"""
with _active_limbo_lock:
re... | Return a list of all Thread objects currently alive.
The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.
| enumerate | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def _template_func(setup, func):
"""Create a timer function. Used if the "statement" is a callable."""
def inner(_it, _timer, _func=func):
setup()
_t0 = _timer()
for _i in _it:
_func()
_t1 = _timer()
return _t1 - _t0
return inner | Create a timer function. Used if the "statement" is a callable. | _template_func | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def print_exc(self, file=None):
"""Helper to print a traceback from the timed code.
Typical use:
t = Timer(...) # outside the try/except
try:
t.timeit(...) # or t.repeat(...)
except:
t.print_exc()
The advantage over ... | Helper to print a traceback from the timed code.
Typical use:
t = Timer(...) # outside the try/except
try:
t.timeit(...) # or t.repeat(...)
except:
t.print_exc()
The advantage over the standard traceback is that source lines... | print_exc | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def timeit(self, number=default_number):
"""Time 'number' executions of the main statement.
To be precise, this executes the setup statement once, and
then returns the time it takes to execute the main statement
a number of times, as a float measured in seconds. The
argument is... | Time 'number' executions of the main statement.
To be precise, this executes the setup statement once, and
then returns the time it takes to execute the main statement
a number of times, as a float measured in seconds. The
argument is the number of times through the loop, defaulting
... | timeit | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def repeat(self, repeat=default_repeat, number=default_number):
"""Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
the secon... | Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
the second argument specifies the timer argument, defaulting
to one million.... | repeat | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def timeit(stmt="pass", setup="pass", timer=default_timer,
number=default_number):
"""Convenience function to create Timer object and call timeit method."""
return Timer(stmt, setup, timer).timeit(number) | Convenience function to create Timer object and call timeit method. | timeit | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number):
"""Convenience function to create Timer object and call repeat method."""
return Timer(stmt, setup, timer).repeat(repeat, number) | Convenience function to create Timer object and call repeat method. | repeat | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def main(args=None, _wrap_timer=None):
"""Main program, used when run as a script.
The optional 'args' argument specifies the command line to be parsed,
defaulting to sys.argv[1:].
The return value is an exit code to be passed to sys.exit(); it
may be None to indicate success.
When an excepti... | Main program, used when run as a script.
The optional 'args' argument specifies the command line to be parsed,
defaulting to sys.argv[1:].
The return value is an exit code to be passed to sys.exit(); it
may be None to indicate success.
When an exception happens during timing, a traceback is print... | main | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/timeit.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/timeit.py | MIT |
def tokenize(readline, tokeneater=printtoken):
"""
The tokenize() function accepts two parameters: one representing the
input stream, and one providing an output mechanism for tokenize().
The first parameter, readline, must be a callable object which provides
the same interface as the readline() me... |
The tokenize() function accepts two parameters: one representing the
input stream, and one providing an output mechanism for tokenize().
The first parameter, readline, must be a callable object which provides
the same interface as the readline() method of built-in file objects.
Each call to the fu... | tokenize | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tokenize.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tokenize.py | MIT |
def generate_tokens(readline):
"""
The generate_tokens() generator requires one argument, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately... |
The generate_tokens() generator requires one argument, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately, readline
can be a callable funct... | generate_tokens | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tokenize.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tokenize.py | MIT |
def modname(path):
"""Return a plausible module name for the patch."""
base = os.path.basename(path)
filename, ext = os.path.splitext(base)
return filename | Return a plausible module name for the patch. | modname | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def fullmodname(path):
"""Return a plausible module name for the path."""
# If the file 'path' is part of a package, then the filename isn't
# enough to uniquely identify it. Try to do the right thing by
# looking in sys.path for the longest matching prefix. We'll
# assume that the rest is the pa... | Return a plausible module name for the path. | fullmodname | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def update(self, other):
"""Merge in the data from another CoverageResults"""
counts = self.counts
calledfuncs = self.calledfuncs
callers = self.callers
other_counts = other.counts
other_calledfuncs = other.calledfuncs
other_callers = other.callers
for ke... | Merge in the data from another CoverageResults | update | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def write_results_file(self, path, lines, lnotab, lines_hit):
"""Return a coverage results file in path."""
try:
outfile = open(path, "w")
except IOError, err:
print >> sys.stderr, ("trace: Could not open %r for writing: %s"
"- skipping"... | Return a coverage results file in path. | write_results_file | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def find_lines_from_code(code, strs):
"""Return dict where keys are lines in the line number table."""
linenos = {}
for _, lineno in dis.findlinestarts(code):
if lineno not in strs:
linenos[lineno] = 1
return linenos | Return dict where keys are lines in the line number table. | find_lines_from_code | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def find_lines(code, strs):
"""Return lineno dict for all code objects reachable from code."""
# get all of the lineno information from the code of this scope level
linenos = find_lines_from_code(code, strs)
# and check the constants for references to other code objects
for c in code.co_consts:
... | Return lineno dict for all code objects reachable from code. | find_lines | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def find_strings(filename):
"""Return a dict of possible docstring positions.
The dict maps line numbers to strings. There is an entry for
line that contains only a string or a part of a triple-quoted
string.
"""
d = {}
# If the first token is a string, then it's the module docstring.
... | Return a dict of possible docstring positions.
The dict maps line numbers to strings. There is an entry for
line that contains only a string or a part of a triple-quoted
string.
| find_strings | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def find_executable_linenos(filename):
"""Return dict where keys are line numbers in the line number table."""
try:
prog = open(filename, "rU").read()
except IOError, err:
print >> sys.stderr, ("Not printing coverage data for %r: %s"
% (filename, err))
r... | Return dict where keys are line numbers in the line number table. | find_executable_linenos | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def __init__(self, count=1, trace=1, countfuncs=0, countcallers=0,
ignoremods=(), ignoredirs=(), infile=None, outfile=None,
timing=False):
"""
@param count true iff it should count number of times each
line is executed
@param trace true iff ... |
@param count true iff it should count number of times each
line is executed
@param trace true iff it should print out each line that is
being counted
@param countfuncs true iff it should just output a list of
(filename, modulename, ... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
def globaltrace_trackcallers(self, frame, why, arg):
"""Handler for call events.
Adds information about who called who to the self._callers dict.
"""
if why == 'call':
# XXX Should do a better job of identifying methods
this_func = self.file_module_function_of(fr... | Handler for call events.
Adds information about who called who to the self._callers dict.
| globaltrace_trackcallers | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/trace.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.