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 globaltrace_countfuncs(self, frame, why, arg): """Handler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict. """ if why == 'call': this_func = self.file_module_function_of(frame) self._calledfuncs[this_func] = 1
Handler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict.
globaltrace_countfuncs
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_lt(self, frame, why, arg): """Handler for call events. If the code block being entered is to be ignored, returns `None', else returns self.localtrace. """ if why == 'call': code = frame.f_code filename = frame.f_globals.get('__file__', Non...
Handler for call events. If the code block being entered is to be ignored, returns `None', else returns self.localtrace.
globaltrace_lt
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/trace.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/trace.py
MIT
def print_list(extracted_list, file=None): """Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.""" if file is None: file = sys.stderr for filename, lineno, name, line in extracted_list: _print(file, ' Fil...
Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.
print_list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/traceback.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/traceback.py
MIT
def format_list(extracted_list): """Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument...
Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; ...
format_list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/traceback.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/traceback.py
MIT
def format_exception(etype, value, tb, limit = None): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. ...
Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly th...
format_exception
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/traceback.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/traceback.py
MIT
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; howe...
Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains...
format_exception_only
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/traceback.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/traceback.py
MIT
def _format_final_exc_line(etype, value): """Return a list of a single line -- normal case for format_exception_only""" valuestr = _some_str(value) if value is None or not valuestr: line = "%s\n" % etype else: line = "%s: %s\n" % (etype, valuestr) return line
Return a list of a single line -- normal case for format_exception_only
_format_final_exc_line
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/traceback.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/traceback.py
MIT
def urlopen(url, data=None, proxies=None, context=None): """Create a file-like object for the specified URL to read from.""" from warnings import warnpy3k warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " "favor of urllib2.urlopen()", stacklevel=2) global _urlopener if pro...
Create a file-like object for the specified URL to read from.
urlopen
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(toBytes(fullurl)) # percent encode url, fixing lame server errors for e.g, like space # within url paths. fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|") ...
Use URLopener().open(file) instead of open(file, 'r').
open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def open_unknown(self, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) raise IOError, ('url error', 'unknown url type', type)
Overridable interface to open unknown URL type.
open_unknown
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def open_unknown_proxy(self, proxy, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) raise IOError, ('url error', 'invalid proxy for %s' % type, proxy)
Overridable interface to open unknown URL type.
open_unknown_proxy
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def retrieve(self, url, filename=None, reporthook=None, data=None): """retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) if self.tempcache and url in self.tempcache: return self.tempcache...
retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.
retrieve
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def http_error(self, url, fp, errcode, errmsg, headers, data=None): """Handle http errors. Derived class can override this, or provide specific handlers named http_error_DDD where DDD is the 3-digit error code.""" # First check if there's a specific handler for this error name = ...
Handle http errors. Derived class can override this, or provide specific handlers named http_error_DDD where DDD is the 3-digit error code.
http_error
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def http_error_default(self, url, fp, errcode, errmsg, headers): """Default error handler: close the connection and raise IOError.""" fp.close() raise IOError, ('http error', errcode, errmsg, headers)
Default error handler: close the connection and raise IOError.
http_error_default
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def open_file(self, url): """Use local file or FTP depending on form of URL.""" if not isinstance(url, str): raise IOError, ('file error', 'proxy support for file protocol currently not implemented') if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': ...
Use local file or FTP depending on form of URL.
open_file
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): """Error 307 -- relocated, but turn POST into error.""" if data is None: return self.http_error_302(url, fp, errcode, errmsg, headers, data) else: return self.http_error_default(url, fp, errcode, errm...
Error 307 -- relocated, but turn POST into error.
http_error_307
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. This function supports Basic authentication only.""" if not 'www-authenticate' in headers: URLopener.http_error_default(self, url, fp, ...
Error 401 -- authentication required. This function supports Basic authentication only.
http_error_401
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def http_error_407(self, url, fp, errcode, errmsg, headers, data=None): """Error 407 -- proxy authentication required. This function supports Basic authentication only.""" if not 'proxy-authenticate' in headers: URLopener.http_error_default(self, url, fp, ...
Error 407 -- proxy authentication required. This function supports Basic authentication only.
http_error_407
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def localhost(): """Return the IP address of the magic hostname 'localhost'.""" global _localhost if _localhost is None: _localhost = socket.gethostbyname('localhost') return _localhost
Return the IP address of the magic hostname 'localhost'.
localhost
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def thishost(): """Return the IP address of the current host.""" global _thishost if _thishost is None: try: _thishost = socket.gethostbyname(socket.gethostname()) except socket.gaierror: _thishost = socket.gethostbyname('localhost') return _thishost
Return the IP address of the current host.
thishost
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def ftperrors(): """Return the set of errors raised by the FTP class.""" global _ftperrors if _ftperrors is None: import ftplib _ftperrors = ftplib.all_errors return _ftperrors
Return the set of errors raised by the FTP class.
ftperrors
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def noheaders(): """Return an empty mimetools.Message object.""" global _noheaders if _noheaders is None: import mimetools try: from cStringIO import StringIO except ImportError: from StringIO import StringIO _noheaders = mimetools.Message(StringIO(), ...
Return an empty mimetools.Message object.
noheaders
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def unwrap(url): """unwrap('<URL:type://host/path>') --> 'type://host/path'.""" url = url.strip() if url[:1] == '<' and url[-1:] == '>': url = url[1:-1].strip() if url[:4] == 'URL:': url = url[4:].strip() return url
unwrap('<URL:type://host/path>') --> 'type://host/path'.
unwrap
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def splithost(url): """splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" global _hostprog if _hostprog is None: import re _hostprog = re.compile('^//([^/?]*)(.*)$') match = _hostprog.match(url) if match: host_port = match.group(1) path = match.group(2) ...
splithost('//host[:port]/path') --> 'host[:port]', '/path'.
splithost
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re _userprog = re.compile('^(.*)@(.*)$') match = _userprog.match(host) if match: return match.group(1, 2) return None, host
splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.
splituser
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def splitnport(host, defport=-1): """Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.""" global _nportprog if _nportprog is None: ...
Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.
splitnport
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def quote(s, safe='/'): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved ...
quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":" | "@" |...
quote
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def quote_plus(s, safe=''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: s = quote(s, safe + ' ') return s.replace(' ', '+') return quote(s, safe)
Quote the query fragment of a URL; replacing ' ' with '+'
quote_plus
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def urlencode(query, doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order o...
Encode a sequence of two-element tuples or dictionary into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order of the parameters in the output wil...
urlencode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def getproxies_environment(): """Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. In order to prefer lowercase variables, we process the environment in two passes, first matches any and se...
Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. In order to prefer lowercase variables, we process the environment in two passes, first matches any and second matches only lower case proxies....
getproxies_environment
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def proxy_bypass_environment(host, proxies=None): """Test if proxies should not be used for a particular host. Checks the proxies dict for the value of no_proxy, which should be a list of comma separated DNS suffixes, or '*' for all hosts. """ if proxies is None: proxies = getproxies_enviro...
Test if proxies should not be used for a particular host. Checks the proxies dict for the value of no_proxy, which should be a list of comma separated DNS suffixes, or '*' for all hosts.
proxy_bypass_environment
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def proxy_bypass_macosx_sysconf(host): """ Return True iff this host shouldn't be accessed using a proxy This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. """ import re import socket from fnmatch import fnmatch ...
Return True iff this host shouldn't be accessed using a proxy This function uses the MacOSX framework SystemConfiguration to fetch the proxy information.
proxy_bypass_macosx_sysconf
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def proxy_bypass(host): """Return True, if a host should be bypassed. Checks proxy settings gathered from the environment, if specified, or from the MacOSX framework SystemConfiguration. """ proxies = getproxies_environment() if proxies: return proxy_bypass_e...
Return True, if a host should be bypassed. Checks proxy settings gathered from the environment, if specified, or from the MacOSX framework SystemConfiguration.
proxy_bypass
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def getproxies_registry(): """Return a dictionary of scheme -> proxy server URL mappings. Win32 uses the registry to store proxies. """ proxies = {} try: import _winreg except ImportError: # Std module, so should be around - but you never know! ...
Return a dictionary of scheme -> proxy server URL mappings. Win32 uses the registry to store proxies.
getproxies_registry
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def proxy_bypass(host): """Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. """ proxies = getproxies_environment() if proxies: return proxy_bypass_environment(host, proxies) ...
Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry.
proxy_bypass
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib.py
MIT
def request_host(request): """Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. """ url = request.get_full_url() host = urlparse.urlparse(url)[1] if host == "": host = request.get_header("Host", "") # remo...
Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison.
request_host
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable, HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will no...
Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable, HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used.
build_opener
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. This is called by the http_error_30x methods when a redirection response is received. If a redirection should take place, return a new Request to allow http_error_30x...
Return a Request or None in response to a redirect. This is called by the http_error_30x methods when a redirection response is received. If a redirection should take place, return a new Request to allow http_error_30x to perform the redirect. Otherwise, raise HTTPError if no-one ...
redirect_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def _parse_proxy(proxy): """Return (scheme, user, password, host/port) given a URL or an authority. If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must have two slashes after the scheme: >>> _parse_proxy('fi...
Return (scheme, user, password, host/port) given a URL or an authority. If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must have two slashes after the scheme: >>> _parse_proxy('file:/ftp.example.com/') Trace...
_parse_proxy
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def reduce_uri(self, uri, default_port=True): """Accept authority or URI and extract only the authority and path.""" # note HTTP URLs do not have a userinfo component parts = urlparse.urlsplit(uri) if parts[1]: # URI scheme = parts[0] authority = parts...
Accept authority or URI and extract only the authority and path.
reduce_uri
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def is_suburi(self, base, test): """Check if test is below base in a URI tree Both args must be URIs in reduced form. """ if base == test: return True if base[0] != test[0]: return False common = posixpath.commonprefix((base[1], test[1])) ...
Check if test is below base in a URI tree Both args must be URIs in reduced form.
is_suburi
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def do_open(self, http_class, req, **http_conn_args): """Return an addinfourl object for the request, using http_class. http_class must implement the HTTPConnection API from httplib. The addinfourl return value is a file-like object. It also has methods and attributes including: ...
Return an addinfourl object for the request, using http_class. http_class must implement the HTTPConnection API from httplib. The addinfourl return value is a file-like object. It also has methods and attributes including: - info(): return a mimetools.Message object for the headers...
do_open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def parse_keqv_list(l): """Parse list of key=value strings where keys are not duplicated.""" parsed = {} for elt in l: k, v = elt.split('=', 1) if v[0] == '"' and v[-1] == '"': v = v[1:-1] parsed[k] = v return parsed
Parse list of key=value strings where keys are not duplicated.
parse_keqv_list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def parse_http_list(s): """Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes c...
Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes count if they are escaped. O...
parse_http_list
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urllib2.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urllib2.py
MIT
def urlparse(url, scheme='', allow_fragments=True): """Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) ...
Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.
urlparse
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def urlsplit(url, scheme='', allow_fragments=True): """Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expa...
Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.
urlsplit
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def urljoin(base, url, allow_fragments=True): """Join a base URL and a possibly relative URL to form an absolute interpretation of the latter.""" if not base: return url if not url: return base bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ urlparse(base, '', all...
Join a base URL and a possibly relative URL to form an absolute interpretation of the latter.
urljoin
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def urldefrag(url): """Removes any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string. """ if '#' in url: s, n, p, a, q, frag = urlparse(url) defrag = urlunparse((s, n, ...
Removes any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string.
urldefrag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings....
Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retain...
parse_qs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A tru...
Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank ...
parse_qsl
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/urlparse.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/urlparse.py
MIT
def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None, int=None, version=None): r"""Create a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a string of 16 bytes in little-endian order as the 'bytes_le' argume...
Create a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a string of 16 bytes in little-endian order as the 'bytes_le' argument, a tuple of six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, 8-bit clock_seq_hi_variant...
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _ifconfig_getnode(): """Get the hardware address on Unix by running ifconfig.""" # This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes. for args in ('', '-a', '-av'): mac = _find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i+1) if mac: return mac
Get the hardware address on Unix by running ifconfig.
_ifconfig_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _arp_getnode(): """Get the hardware address on Unix by running arp.""" import os, socket try: ip_addr = socket.gethostbyname(socket.gethostname()) except EnvironmentError: return None # Try getting the MAC addr from arp based on our IP address (Solaris). return _find_mac('ar...
Get the hardware address on Unix by running arp.
_arp_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _lanscan_getnode(): """Get the hardware address on Unix by running lanscan.""" # This might work on HP-UX. return _find_mac('lanscan', '-ai', ['lan0'], lambda i: 0)
Get the hardware address on Unix by running lanscan.
_lanscan_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _netstat_getnode(): """Get the hardware address on Unix by running netstat.""" # This might work on AIX, Tru64 UNIX and presumably on IRIX. try: pipe = _popen('netstat', '-ia') if not pipe: return with pipe: words = pipe.readline().rstrip().split() ...
Get the hardware address on Unix by running netstat.
_netstat_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _ipconfig_getnode(): """Get the hardware address on Windows by running ipconfig.exe.""" import os, re dirs = ['', r'c:\windows\system32', r'c:\winnt\system32'] try: import ctypes buffer = ctypes.create_string_buffer(300) ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300)...
Get the hardware address on Windows by running ipconfig.exe.
_ipconfig_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32...
Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.
_netbios_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _unixdll_getnode(): """Get the hardware address on Unix using ctypes.""" _buffer = ctypes.create_string_buffer(16) _uuid_generate_time(_buffer) return UUID(bytes=_buffer.raw).node
Get the hardware address on Unix using ctypes.
_unixdll_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _windll_getnode(): """Get the hardware address on Windows using ctypes.""" _buffer = ctypes.create_string_buffer(16) if _UuidCreate(_buffer) == 0: return UUID(bytes=_buffer.raw).node
Get the hardware address on Windows using ctypes.
_windll_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _random_getnode(): """Get a random node ID, with eighth bit set as suggested by RFC 4122.""" import random return random.randrange(0, 1<<48L) | 0x010000000000L
Get a random node ID, with eighth bit set as suggested by RFC 4122.
_random_getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def getnode(): """Get the hardware address as a 48-bit positive integer. The first time this runs, it may launch a separate program, which could be quite slow. If all attempts to obtain the hardware address fail, we choose a random 48-bit number with its eighth bit set to 1 as recommended in RFC 4...
Get the hardware address as a 48-bit positive integer. The first time this runs, it may launch a separate program, which could be quite slow. If all attempts to obtain the hardware address fail, we choose a random 48-bit number with its eighth bit set to 1 as recommended in RFC 4122.
getnode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def uuid1(node=None, clock_seq=None): """Generate a UUID from a host ID, sequence number, and the current time. If 'node' is not given, getnode() is used to obtain the hardware address. If 'clock_seq' is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.""" ...
Generate a UUID from a host ID, sequence number, and the current time. If 'node' is not given, getnode() is used to obtain the hardware address. If 'clock_seq' is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.
uuid1
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def uuid3(namespace, name): """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" from hashlib import md5 hash = md5(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=3)
Generate a UUID from the MD5 hash of a namespace UUID and a name.
uuid3
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def uuid5(namespace, name): """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" from hashlib import sha1 hash = sha1(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=5)
Generate a UUID from the SHA-1 hash of a namespace UUID and a name.
uuid5
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/uuid.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/uuid.py
MIT
def _show_warning(message, category, filename, lineno, file=None, line=None): """Hook to write a warning to a file; replace if you like.""" if file is None: file = sys.stderr if file is None: # sys.stderr is None - warnings get lost return try: file.write(form...
Hook to write a warning to a file; replace if you like.
_show_warning
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def formatwarning(message, category, filename, lineno, line=None): """Function to format a warning the standard way.""" try: unicodetype = unicode except NameError: unicodetype = () try: message = str(message) except UnicodeEncodeError: pass s = "%s: %s: %s\n" % ...
Function to format a warning the standard way.
formatwarning
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def filterwarnings(action, message="", category=Warning, module="", lineno=0, append=0): """Insert an entry into the list of warnings filters (at the front). 'action' -- one of "error", "ignore", "always", "default", "module", or "once" 'message' -- a regex that the warni...
Insert an entry into the list of warnings filters (at the front). 'action' -- one of "error", "ignore", "always", "default", "module", or "once" 'message' -- a regex that the warning message must match 'category' -- a class that the warning must be a subclass of 'module' -- a regex that...
filterwarnings
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def simplefilter(action, category=Warning, lineno=0, append=0): """Insert a simple entry into the list of warnings filters (at the front). A simple filter matches all modules and messages. 'action' -- one of "error", "ignore", "always", "default", "module", or "once" 'category' -- a cla...
Insert a simple entry into the list of warnings filters (at the front). A simple filter matches all modules and messages. 'action' -- one of "error", "ignore", "always", "default", "module", or "once" 'category' -- a class that the warning must be a subclass of 'lineno' -- an integer li...
simplefilter
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def warn(message, category=None, stacklevel=1): """Issue a warning, or maybe ignore it or raise an exception.""" # Check if message is already a Warning object if isinstance(message, Warning): category = message.__class__ # Check category argument if category is None: category = User...
Issue a warning, or maybe ignore it or raise an exception.
warn
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def __init__(self, record=False, module=None): """Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. For compatibility with Python 3.0, please consider all arguments to be keyword-only. """ self._record = r...
Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. For compatibility with Python 3.0, please consider all arguments to be keyword-only.
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/warnings.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/warnings.py
MIT
def itervaluerefs(self): """Return an iterator that yields the weak references to the values. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creat...
Return an iterator that yields the weak references to the values. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the g...
itervaluerefs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/weakref.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/weakref.py
MIT
def iterkeyrefs(self): """Return an iterator that yields the weak references to the keys. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating ...
Return an iterator that yields the weak references to the keys. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the gar...
iterkeyrefs
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/weakref.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/weakref.py
MIT
def register(name, klass, instance=None, update_tryorder=1): """Register a browser connector and, optionally, connection.""" _browsers[name.lower()] = [klass, instance] if update_tryorder > 0: _tryorder.append(name) elif update_tryorder < 0: _tryorder.insert(0, name)
Register a browser connector and, optionally, connection.
register
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/webbrowser.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/webbrowser.py
MIT
def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if using is not None: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if '%s' in browser: # User gave us a command line, split it into nam...
Return a browser launcher instance appropriate for the environment.
get
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/webbrowser.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/webbrowser.py
MIT
def _synthesize(browser, update_tryorder=1): """Attempt to synthesize a controller base on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installatio...
Attempt to synthesize a controller base on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installation of the desired browser in this way. If we...
_synthesize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/webbrowser.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/webbrowser.py
MIT
def _iscommand(cmd): """Return True if cmd is executable or can be found on the executable search path.""" if _isexecutable(cmd): return True path = os.environ.get("PATH") if not path: return False for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if _is...
Return True if cmd is executable or can be found on the executable search path.
_iscommand
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/webbrowser.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/webbrowser.py
MIT
def whichdb(filename): """Guess which db package to use to open a db file. Return values: - None if the database file can't be read; - empty string if the file can be read but can't be recognized - the module name (e.g. "dbm" or "gdbm") if recognized. Importing the given module may still fail...
Guess which db package to use to open a db file. Return values: - None if the database file can't be read; - empty string if the file can be read but can't be recognized - the module name (e.g. "dbm" or "gdbm") if recognized. Importing the given module may still fail, and opening the database...
whichdb
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/whichdb.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/whichdb.py
MIT
def raise_conversion_error(function): """ Wrap any raised struct.errors in a ConversionError. """ @wraps(function) def result(self, value): try: return function(self, value) except struct.error as e: raise ConversionError(e.args[0]) return result
Wrap any raised struct.errors in a ConversionError.
raise_conversion_error
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xdrlib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xdrlib.py
MIT
def getparser(use_datetime=0): """getparser() -> parser, unmarshaller Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects. """ if use_datetime and not datetime: raise ValueError, "the datetime module is not available" if Fas...
getparser() -> parser, unmarshaller Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects.
getparser
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def dumps(params, methodname=None, methodresponse=None, encoding=None, allow_none=0): """data [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following o...
data [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall pac...
dumps
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def loads(data, use_datetime=0): """data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception. """ p, u = getparser(use_datetime=...
data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception.
loads
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def gzip_encode(data): """data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO() gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) gzf.write(data) gzf.close() ...
data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952
gzip_encode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def gzip_decode(data, max_decode=20971520): """gzip encoded data -> unencoded data Decode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO(data) gzf = gzip.GzipFile(mode="rb", fileobj=f) try: if ma...
gzip encoded data -> unencoded data Decode data using the gzip content encoding as described in RFC 1952
gzip_decode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def __call__(self, attr): """A workaround to get special attributes on the ServerProxy without interfering with the magic __getattr__ """ if attr == "close": return self.__close elif attr == "transport": return self.__transport raise AttributeEr...
A workaround to get special attributes on the ServerProxy without interfering with the magic __getattr__
__call__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/xmlrpclib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/xmlrpclib.py
MIT
def is_zipfile(filename): """Quickly see if a file is a ZIP file by checking the magic number. The filename argument may be a file or file-like object too. """ result = False try: if hasattr(filename, "read"): result = _check_zipfile(fp=filename) else: with o...
Quickly see if a file is a ZIP file by checking the magic number. The filename argument may be a file or file-like object too.
is_zipfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def _EndRecData64(fpin, offset, endrec): """ Read the ZIP64 end-of-archive records and use that to update endrec """ try: fpin.seek(offset - sizeEndCentDir64Locator, 2) except IOError: # If the seek fails, the file is not large enough to contain a ZIP64 # end-of-archive recor...
Read the ZIP64 end-of-archive records and use that to update endrec
_EndRecData64
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def _EndRecData(fpin): """Return data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.""" # Determine file size fpin.seek(0, 2) filesize = fpin.tell() ...
Return data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.
_EndRecData
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def FileHeader(self, zip64=None): """Return the per-file header as a string.""" dt = self.date_time dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2] dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2) if self.flag_bits & 0x08: # Set these to zero because we write them...
Return the per-file header as a string.
FileHeader
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def peek(self, n=1): """Returns buffered bytes without advancing the position.""" if n > len(self._readbuffer) - self._offset: chunk = self.read(n) if len(chunk) > self._offset: self._readbuffer = chunk + self._readbuffer[self._offset:] self._offse...
Returns buffered bytes without advancing the position.
peek
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def read1(self, n): """Read up to n bytes with at most one read() system call.""" # Simplify algorithm (branching) by transforming negative n to large n. if n < 0 or n is None: n = self.MAX_N # Bytes available in read buffer. len_readbuffer = len(self._readbuffer) -...
Read up to n bytes with at most one read() system call.
read1
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=False): """Open the ZIP file with mode read "r", write "w" or append "a".""" if mode not in ("r", "w", "a"): raise RuntimeError('ZipFile() requires mode "r", "w", or "a"') if compression == ZIP_STORED: ...
Open the ZIP file with mode read "r", write "w" or append "a".
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp try: endrec = _EndRecData(fp) except IOError: raise BadZipfile("File is not a zip file") if not endrec: raise BadZipfile, "File is not a zip file" ...
Read in the table of contents for the ZIP file.
_RealGetContents
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def namelist(self): """Return a list of file names in the archive.""" l = [] for data in self.filelist: l.append(data.filename) return l
Return a list of file names in the archive.
namelist
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def printdir(self): """Print a table of contents for the zip file.""" print "%-46s %19s %12s" % ("File Name", "Modified ", "Size") for zinfo in self.filelist: date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6] print "%-46s %s %12d" % (zinfo.filename, date, zinf...
Print a table of contents for the zip file.
printdir
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def testzip(self): """Read all the files and check the CRC.""" chunk_size = 2 ** 20 for zinfo in self.filelist: try: # Read by chunks, to avoid an OverflowError or a # MemoryError with very large embedded files. with self.open(zinfo.fil...
Read all the files and check the CRC.
testzip
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) if info is None: raise KeyError( 'There is no item named %r in the archive' % name) return info
Return the instance of ZipInfo given 'name'.
getinfo
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def open(self, name, mode="r", pwd=None): """Return file-like object for 'name'.""" if mode not in ("r", "U", "rU"): raise RuntimeError, 'open() requires mode "r", "U", or "rU"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was ...
Return file-like object for 'name'.
open
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def extract(self, member, path=None, pwd=None): """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 ZipInfo object. You can specify a different di...
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 ZipInfo object. You can specify a different directory using `path'.
extract
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def extractall(self, path=None, members=None, pwd=None): """Extract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist(). """ ...
Extract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist().
extractall
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT
def _extract_member(self, member, targetpath, pwd): """Extract the ZipInfo object 'member' to a physical file on the path targetpath. """ # build the destination pathname, replacing # forward slashes to platform specific separators. arcname = member.filename.replace('/...
Extract the ZipInfo object 'member' to a physical file on the path targetpath.
_extract_member
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/zipfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/zipfile.py
MIT