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 makefile(self, mode='r', bufsize=-1): """Make and return a file-like object that works with the SSL connection. Just use the code from the socket module.""" self._makefile_refs += 1 # close=True so as to decrement the reference count when done with # the file-like ...
Make and return a file-like object that works with the SSL connection. Just use the code from the socket module.
makefile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def get_channel_binding(self, cb_type="tls-unique"): """Get channel binding data for current connection. Raise ValueError if the requested `cb_type` is not supported. Return bytes of the data or None if the data is not available (e.g. before the handshake). """ if cb_type not i...
Get channel binding data for current connection. Raise ValueError if the requested `cb_type` is not supported. Return bytes of the data or None if the data is not available (e.g. before the handshake).
get_channel_binding
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def version(self): """ Return a string identifying the protocol version used by the current SSL channel, or None if there is no established channel. """ if self._sslobj is None: return None return self._sslobj.version()
Return a string identifying the protocol version used by the current SSL channel, or None if there is no established channel.
version
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def cert_time_to_seconds(cert_time): """Return the time in seconds since the Epoch, given the timestring representing the "notBefore" or "notAfter" date from a certificate in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale). "notBefore" or "notAfter" dates must use UTC (RFC 5280). Month is on...
Return the time in seconds since the Epoch, given the timestring representing the "notBefore" or "notAfter" date from a certificate in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale). "notBefore" or "notAfter" dates must use UTC (RFC 5280). Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oc...
cert_time_to_seconds
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def DER_cert_to_PEM_cert(der_cert_bytes): """Takes a certificate in binary DER format and returns the PEM version of it as a string.""" f = base64.standard_b64encode(der_cert_bytes).decode('ascii') return (PEM_HEADER + '\n' + textwrap.fill(f, 64) + '\n' + PEM_FOOTER + '\n')
Takes a certificate in binary DER format and returns the PEM version of it as a string.
DER_cert_to_PEM_cert
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def PEM_cert_to_DER_cert(pem_cert_string): """Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence""" if not pem_cert_string.startswith(PEM_HEADER): raise ValueError("Invalid PEM encoding; must start with %s" % PEM_HEADER) ...
Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence
PEM_cert_to_DER_cert
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None): """Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connect...
Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connection attempt.
get_server_certificate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def sslwrap_simple(sock, keyfile=None, certfile=None): """A replacement for the old socket.ssl function. Designed for compability with Python 2.5 and earlier. Will disappear in Python 3.0.""" if hasattr(sock, "_sock"): sock = sock._sock ctx = SSLContext(PROTOCOL_SSLv23) if keyfile or ...
A replacement for the old socket.ssl function. Designed for compability with Python 2.5 and earlier. Will disappear in Python 3.0.
sslwrap_simple
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments mus...
maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length.
maketrans
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/string.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/string.py
MIT
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if not isinstance(x, basestring): x = repr(x) return x.zfill(width)
zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated.
zfill
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/string.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/string.py
MIT
def translate(s, table, deletions=""): """translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string...
translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. The deletions argument is...
translate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/string.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/string.py
MIT
def next(self): """A file object is its own iterator, for example iter(f) returns f (unless f is closed). When a file is used as an iterator, typically in a for loop (for example, for line in f: print line), the next() method is called repeatedly. This method returns the next input line,...
A file object is its own iterator, for example iter(f) returns f (unless f is closed). When a file is used as an iterator, typically in a for loop (for example, for line in f: print line), the next() method is called repeatedly. This method returns the next input line, or raises StopIter...
next
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def seek(self, pos, mode = 0): """Set the file's current position. The mode argument is optional and defaults to 0 (absolute file positioning); other values are 1 (seek relative to the current position) and 2 (seek relative to the file's end). There is no return value. ...
Set the file's current position. The mode argument is optional and defaults to 0 (absolute file positioning); other values are 1 (seek relative to the current position) and 2 (seek relative to the file's end). There is no return value.
seek
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def readline(self, length=None): r"""Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). If the size argument is present and non-negative, it is a maximum byte count (including the t...
Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). If the size argument is present and non-negative, it is a maximum byte count (including the trailing newline) and an incomplete line may b...
readline
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def readlines(self, sizehint = 0): """Read until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (or more to accommodate a final ...
Read until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (or more to accommodate a final whole line).
readlines
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def truncate(self, size=None): """Truncate the file's size. If the optional size argument is present, the file is truncated to (at most) that size. The size defaults to the current position. The current file position is not changed unless the position is beyond the new file size...
Truncate the file's size. If the optional size argument is present, the file is truncated to (at most) that size. The size defaults to the current position. The current file position is not changed unless the position is beyond the new file size. If the specified size exceeds t...
truncate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def write(self, s): """Write a string to the file. There is no return value. """ _complain_ifclosed(self.closed) if not s: return # Force s to be a string or unicode if not isinstance(s, basestring): s = str(s) spos = self.pos slen = s...
Write a string to the file. There is no return value.
write
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def writelines(self, iterable): """Write a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings. There is no return value. (The name is intended to match readlines(); writelines() does not add line separators.) ...
Write a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings. There is no return value. (The name is intended to match readlines(); writelines() does not add line separators.)
writelines
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def getvalue(self): """ Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called. The StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings th...
Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called. The StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-b...
getvalue
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/StringIO.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/StringIO.py
MIT
def atof(s): """atof(s) -> float Return the floating point number represented by the string s. """ if type(s) == _StringType: return _float(s) else: raise TypeError('argument 1: expected string, %s found' % type(s).__name__)
atof(s) -> float Return the floating point number represented by the string s.
atof
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def atoi(*args): """atoi(s [,base]) -> int Return the integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X f...
atoi(s [,base]) -> int Return the integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. If base...
atoi
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def atol(*args): """atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x o...
atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. I...
atol
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def ljust(s, width): """ljust(s, width) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return s + ' '*n
ljust(s, width) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated.
ljust
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def rjust(s, width): """rjust(s, width) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return ' '*n + s
rjust(s, width) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated.
rjust
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def center(s, width): """center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: # This ensures that c...
center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated.
center
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = repr(x) n = len(s) if n >= width: return s sign = '' if s[0] in...
zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated.
zfill
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def expandtabs(s, tabsize=8): """expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). """ res = line = '' for c in s: if c == '\t': ...
expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8).
expandtabs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments mus...
maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length.
maketrans
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/stringold.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/stringold.py
MIT
def _args_from_interpreter_flags(): """Return a list of command-line arguments reproducing the current settings in sys.flags and sys.warnoptions.""" flag_opt_map = { 'debug': 'd', # 'inspect': 'i', # 'interactive': 'i', 'optimize': 'O', 'dont_write_bytecode': 'B', ...
Return a list of command-line arguments reproducing the current settings in sys.flags and sys.warnoptions.
_args_from_interpreter_flags
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the...
Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the Popen constructor. Example: check_call...
check_call
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def check_output(*popenargs, **kwargs): r"""Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The ...
Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen construc...
check_output
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def communicate(self, input=None): """Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data s...
Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child. communica...
communicate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ to_close = set() if stdin is None and stdout is None and stderr is None: return (None, Non...
Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
_get_handles
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _make_inheritable(self, handle): """Return a duplicate of handle, which is inheritable""" return _subprocess.DuplicateHandle(_subprocess.GetCurrentProcess(), handle, _subprocess.GetCurrentProcess(), 0, 1, _subprocess.DUPLICATE_S...
Return a duplicate of handle, which is inheritable
_make_inheritable
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _find_w9xpopen(self): """Find and return absolut path to w9xpopen.exe""" w9xpopen = os.path.join( os.path.dirname(_subprocess.GetModuleFileName(0)), "w9xpopen.exe") if not os.path.exists(w9xpopen): # ...
Find and return absolut path to w9xpopen.exe
_find_w9xpopen
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _internal_poll(self, _deadstate=None, _WaitForSingleObject=_subprocess.WaitForSingleObject, _WAIT_OBJECT_0=_subprocess.WAIT_OBJECT_0, _GetExitCodeProcess=_subprocess.GetExitCodeProcess): """Check if child process has terminated. Returns returncode ...
Check if child process has terminated. Returns returncode attribute. This method is called by __del__, so it can only refer to objects in its local scope.
_internal_poll
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode is None: _subprocess.WaitForSingleObject(self._handle, _subprocess.INFINITE) self.returncode = ...
Wait for child process to terminate. Returns returncode attribute.
wait
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ to_close = set() p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None err...
Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
_get_handles
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def pipe_cloexec(self): """Create a pipe with FDs set CLOEXEC.""" # Pipes' FDs are set CLOEXEC by default because we don't want them # to be inherited by other subprocesses: the CLOEXEC flag is removed # from the child's FDs by _dup2(), between fork() and exec(). ...
Create a pipe with FDs set CLOEXEC.
pipe_cloexec
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def _internal_poll(self, _deadstate=None, _waitpid=os.waitpid, _WNOHANG=os.WNOHANG, _os_error=os.error, _ECHILD=errno.ECHILD): """Check if child process has terminated. Returns returncode attribute. This method is called by __del__, so it cannot reference anything ...
Check if child process has terminated. Returns returncode attribute. This method is called by __del__, so it cannot reference anything outside of the local scope (nor can any methods it calls).
_internal_poll
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" while self.returncode is None: try: pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0) except OSError as e: if e.errno ...
Wait for child process to terminate. Returns returncode attribute.
wait
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/subprocess.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py
MIT
def gethdr(fp): """Read a sound header from an open file.""" if fp.read(4) != MAGIC: raise error, 'gethdr: bad magic word' hdr_size = get_long_be(fp.read(4)) data_size = get_long_be(fp.read(4)) encoding = get_long_be(fp.read(4)) sample_rate = get_long_be(fp.read(4)) channels = get_lo...
Read a sound header from an open file.
gethdr
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sunaudio.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sunaudio.py
MIT
def printhdr(file): """Read and print the sound header of a named file.""" hdr = gethdr(open(file, 'r')) data_size, encoding, sample_rate, channels, info = hdr while info[-1:] == '\0': info = info[:-1] print 'File name: ', file print 'Data size: ', data_size print 'Encoding: ', e...
Read and print the sound header of a named file.
printhdr
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sunaudio.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sunaudio.py
MIT
def get_namespace(self): """Returns the single namespace bound to this name. Raises ValueError if the name is bound to multiple namespaces. """ if len(self.__namespaces) != 1: raise ValueError, "name is bound to multiple namespaces" return self.__namespaces[0]
Returns the single namespace bound to this name. Raises ValueError if the name is bound to multiple namespaces.
get_namespace
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/symtable.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/symtable.py
MIT
def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ import re # Regexes needed for parsing Makefile (and si...
Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
_parse_makefile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def get_makefile_filename(): """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") return os.path.join(get_path('platstdlib'), "config", "Makefile")
Return the path of the Makefile.
get_makefile_filename
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def _generate_posix_vars(): """Generate the Python module containing build-time variables.""" import pprint vars = {} # load the installed Makefile: makefile = get_makefile_filename() try: _parse_makefile(makefile, vars) except IOError, e: msg = "invalid Python installation: ...
Generate the Python module containing build-time variables.
_generate_posix_vars
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def _init_posix(vars): """Initialize the module as appropriate for POSIX systems.""" # _sysconfigdata is generated at build time, see _generate_posix_vars() from _sysconfigdata import build_time_vars vars.update(build_time_vars)
Initialize the module as appropriate for POSIX systems.
_init_posix
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] =...
Initialize the module as appropriate for NT
_init_non_posix
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def parse_config_h(fp, vars=None): """Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ import re if vars is None: vars = {} define_rx = r...
Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
parse_config_h
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def get_scheme_names(): """Returns a tuple containing the schemes names.""" schemes = _INSTALL_SCHEMES.keys() schemes.sort() return tuple(schemes)
Returns a tuple containing the schemes names.
get_scheme_names
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): """Returns a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. """ if expand: return _expand_vars(scheme, vars) el...
Returns a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform.
get_paths
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values ...
With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up eac...
get_config_vars
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def get_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the...
Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included...
get_platform
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sysconfig.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sysconfig.py
MIT
def check(file): """check(file_or_dir) If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The ...
check(file_or_dir) If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The diagnostic messages are ...
check
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tabnanny.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tabnanny.py
MIT
def nts(s): """Convert a null-terminated string field to a python string. """ # Use the string up to the first null char. p = s.find("\0") if p == -1: return s return s[:p]
Convert a null-terminated string field to a python string.
nts
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): try: n = int(nts(s).strip() or "0", 8) except ValueError: raise InvalidHeaderError("invalid header") ...
Convert a number field to a python number.
nti
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def itn(n, digits=8, format=DEFAULT_FORMAT): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than # tha...
Convert a python number to a number field.
itn
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be di...
Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in ...
calc_chksums
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if length == 0: return if length is None: shutil.copyfileobj(src, dst) return BUFSIZE = 16 * 1024 blocks, remainder = divm...
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content.
copyfileobj
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def filemode(mode): """Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list() """ perm = [] for table in filemode_table: for bit, char in table: if mode & bit == bit: perm.append(char) break else: ...
Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list()
filemode
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_write_gz(self): """Initialize for writing with gzip compression. """ self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED, -self.zlib.MAX_WBITS, self.zlib.DEF_MEM_LEVEL, ...
Initialize for writing with gzip compression.
_init_write_gz
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def __write(self, s): """Write string s to the stream if a whole new block is ready to be written. """ self.buf += s while len(self.buf) > self.bufsize: self.fileobj.write(self.buf[:self.bufsize]) self.buf = self.buf[self.bufsize:]
Write string s to the stream if a whole new block is ready to be written.
__write
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def close(self): """Close the _Stream object. No operation should be done on it afterwards. """ if self.closed: return self.closed = True try: if self.mode == "w" and self.comptype != "tar": self.buf += self.cmp.flush() ...
Close the _Stream object. No operation should be done on it afterwards.
close
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_read_gz(self): """Initialize for reading a gzip compressed fileobj. """ self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS) self.dbuf = "" # taken from gzip.GzipFile with some alterations if self.__read(2) != "\037\213": raise ReadError("not a ...
Initialize for reading a gzip compressed fileobj.
_init_read_gz
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def seek(self, pos=0): """Set the stream's file pointer to pos. Negative seeking is forbidden. """ if pos - self.pos >= 0: blocks, remainder = divmod(pos - self.pos, self.bufsize) for i in xrange(blocks): self.read(self.bufsize) self...
Set the stream's file pointer to pos. Negative seeking is forbidden.
seek
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def read(self, size=None): """Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF. """ if size is None: t = [] while True: buf = self._read(self.bufsize) ...
Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.
read
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _read(self, size): """Return size bytes from the stream. """ if self.comptype == "tar": return self.__read(size) c = len(self.dbuf) t = [self.dbuf] while c < size: buf = self.__read(self.bufsize) if not buf: break ...
Return size bytes from the stream.
_read
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def __read(self, size): """Return size bytes from stream. If internal buffer is empty, read another block from the stream. """ c = len(self.buf) t = [self.buf] while c < size: buf = self.fileobj.read(self.bufsize) if not buf: bre...
Return size bytes from stream. If internal buffer is empty, read another block from the stream.
__read
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def readsparsesection(self, size): """Read a single section of a sparse file. """ section = self.sparse.find(self.position) if section is None: return "" size = min(size, section.offset + section.size - self.position) if isinstance(section, _data): ...
Read a single section of a sparse file.
readsparsesection
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def read(self, size=None): """Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached. """ if self.closed: raise ValueError("I/O operation on closed file") buf = "" if self.buffer: if size is No...
Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached.
read
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def readline(self, size=-1): """Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line. """ if self.closed: raise ValueError("I/O operation on closed file") if "\n...
Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line.
readline
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def readlines(self): """Return a list with all remaining lines. """ result = [] while True: line = self.readline() if not line: break result.append(line) return result
Return a list with all remaining lines.
readlines
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def seek(self, pos, whence=os.SEEK_SET): """Seek to a position in the file. """ if self.closed: raise ValueError("I/O operation on closed file") if whence == os.SEEK_SET: self.position = min(max(pos, 0), self.size) elif whence == os.SEEK_CUR: ...
Seek to a position in the file.
seek
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def __iter__(self): """Get an iterator over the file's lines. """ while True: line = self.readline() if not line: break yield line
Get an iterator over the file's lines.
__iter__
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, name=""): """Construct a TarInfo object. name is the optional name of the member. """ self.name = name # member name self.mode = 0644 # file permissions self.uid = 0 # user id self.gid = 0 # group id ...
Construct a TarInfo object. name is the optional name of the member.
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def get_info(self, encoding, errors): """Return the TarInfo's attributes as a dictionary. """ info = { "name": self.name, "mode": self.mode & 07777, "uid": self.uid, "gid": self.gid, "size": self.size, ...
Return the TarInfo's attributes as a dictionary.
get_info
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="strict"): """Return a tar header as a string of 512 byte blocks. """ info = self.get_info(encoding, errors) if format == USTAR_FORMAT: return self.create_ustar_header(info) elif format == GNU_FORMAT: ...
Return a tar header as a string of 512 byte blocks.
tobuf
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def create_ustar_header(self, info): """Return the object as a ustar header block. """ info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: raise ValueError("linkname is too long") if len(info["name"]) > LENGTH_NAME: info["prefix"], info["...
Return the object as a ustar header block.
create_ustar_header
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def create_gnu_header(self, info): """Return the object as a GNU header block sequence. """ info["magic"] = GNU_MAGIC buf = "" if len(info["linkname"]) > LENGTH_LINK: buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK) if len(info["name"]...
Return the object as a GNU header block sequence.
create_gnu_header
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def create_pax_header(self, info, encoding, errors): """Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. """ info["magic"] = POSIX_MAGIC pax_headers = self.pax_header...
Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information.
create_pax_header
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix and a name part. """ prefix = name[:LENGTH_PREFIX + 1] while prefix and prefix[-1] != "/": prefix = prefix[:-1] name = name[len(prefix):] prefix = prefix[:-1] ...
Split a name longer than 100 chars into a prefix and a name part.
_posix_split_name
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _create_header(info, format): """Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100), itn(info.get("mode", 0) & 07777, 8, format), itn(info...
Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants.
_create_header
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _create_payload(payload): """Return the string payload filled with zero bytes up to the next 512 byte border. """ blocks, remainder = divmod(len(payload), BLOCKSIZE) if remainder > 0: payload += (BLOCKSIZE - remainder) * NUL return payload
Return the string payload filled with zero bytes up to the next 512 byte border.
_create_payload
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _create_pax_generic_header(cls, pax_headers, type=XHDTYPE): """Return a POSIX.1-2001 extended or global header sequence that contains a list of keyword, value pairs. The values must be unicode objects. """ records = [] for keyword, value in pax_headers.iteritems...
Return a POSIX.1-2001 extended or global header sequence that contains a list of keyword, value pairs. The values must be unicode objects.
_create_pax_generic_header
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. """ if len(buf) == 0: raise EmptyHeaderError("empty header") if len(buf) != BLOCKSIZE: raise TruncatedHeaderError("truncated header") if buf.count(NUL) == BLOCKSIZE: ...
Construct a TarInfo object from a 512 byte string buffer.
frombuf
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def fromtarfile(cls, tarfile): """Return the next TarInfo object from TarFile object tarfile. """ buf = tarfile.fileobj.read(BLOCKSIZE) obj = cls.frombuf(buf) obj.offset = tarfile.fileobj.tell() - BLOCKSIZE return obj._proc_member(tarfile)
Return the next TarInfo object from TarFile object tarfile.
fromtarfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _proc_member(self, tarfile): """Choose the right processing method depending on the type and call it. """ if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): return self._proc_gnulong(tarfile) elif self.type == GNUTYPE_SPARSE: return self._proc_sp...
Choose the right processing method depending on the type and call it.
_proc_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 _proc_builtin(self, tarfile): """Process a builtin type or an unknown type which will be treated as a regular file. """ self.offset_data = tarfile.fileobj.tell() offset = self.offset_data if self.isreg() or self.type not in SUPPORTED_TYPES: # Skip the f...
Process a builtin type or an unknown type which will be treated as a regular file.
_proc_builtin
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _proc_gnulong(self, tarfile): """Process the blocks that hold a GNU longname or longlink member. """ buf = tarfile.fileobj.read(self._block(self.size)) # Fetch the next header and process it. try: next = self.fromtarfile(tarfile) except HeaderE...
Process the blocks that hold a GNU longname or longlink member.
_proc_gnulong
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _proc_sparse(self, tarfile): """Process a GNU sparse header plus extra headers. """ buf = self.buf sp = _ringbuffer() pos = 386 lastpos = 0L realpos = 0L # There are 4 possible sparse structs in the # first header. for i in xrange(4): ...
Process a GNU sparse header plus extra headers.
_proc_sparse
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _proc_pax(self, tarfile): """Process an extended or global header as described in POSIX.1-2001. """ # Read the header information. buf = tarfile.fileobj.read(self._block(self.size)) # A pax header stores supplemental information for either # the following ...
Process an extended or global header as described in POSIX.1-2001.
_proc_pax
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _apply_pax_info(self, pax_headers, encoding, errors): """Replace fields with supplemental information from a previous pax extended or global header. """ for keyword, value in pax_headers.iteritems(): if keyword not in PAX_FIELDS: continue i...
Replace fields with supplemental information from a previous pax extended or global header.
_apply_pax_info
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. """ blocks, remainder = divmod(count, BLOCKSIZE) if remainder: blocks += 1 return blocks * BLOCKSIZE
Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024.
_block
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, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors=None, pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an ...
Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing d...
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for readin...
Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression ...
open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def taropen(cls, name, mode="r", fileobj=None, **kwargs): """Open uncompressed tar archive name for reading or writing. """ if mode not in ("r", "a", "w"): raise ValueError("mode must be 'r', 'a' or 'w'") return cls(name, mode, fileobj, **kwargs)
Open uncompressed tar archive name for reading or writing.
taropen
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if mode not in ("r", "w"): raise ValueError("mode must be 'r' or 'w'") try: import ...
Open gzip compressed tar archive name for reading or writing. Appending is not allowed.
gzopen
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if mode not in ("r", "w"): raise ValueError("mode must be 'r' or 'w'.") try: impo...
Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed.
bz2open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT
def close(self): """Close the TarFile. In write-mode, two finishing zero blocks are appended to the archive. """ if self.closed: return self.closed = True try: if self.mode in "aw": self.fileobj.write(NUL * (BLOCKSIZE * 2)) ...
Close the TarFile. In write-mode, two finishing zero blocks are appended to the archive.
close
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/tarfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py
MIT