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 add(self, element): """Add an element to a set. This has no effect if the element is already present. """ try: self._data[element] = True except TypeError: transform = getattr(element, "__as_immutable__", None) if transform is None: ...
Add an element to a set. This has no effect if the element is already present.
add
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sets.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sets.py
MIT
def remove(self, element): """Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError. """ try: del self._data[element] except TypeError: transform = getattr(element, "__as_temporarily_immutable__", None) ...
Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError.
remove
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sets.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sets.py
MIT
def discard(self, element): """Remove an element from a set if it is a member. If the element is not a member, do nothing. """ try: self.remove(element) except KeyError: pass
Remove an element from a set if it is a member. If the element is not a member, do nothing.
discard
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sets.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sets.py
MIT
def reset(self): """Reset this instance. Loses all unprocessed data.""" self.__starttag_text = None self.rawdata = '' self.stack = [] self.lasttag = '???' self.nomoretags = 0 self.literal = 0 markupbase.ParserBase.reset(self)
Reset this instance. Loses all unprocessed data.
reset
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sgmllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sgmllib.py
MIT
def convert_charref(self, name): """Convert character reference, may be overridden.""" try: n = int(name) except ValueError: return if not 0 <= n <= 127: return return self.convert_codepoint(n)
Convert character reference, may be overridden.
convert_charref
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sgmllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sgmllib.py
MIT
def handle_charref(self, name): """Handle character reference, no need to override.""" replacement = self.convert_charref(name) if replacement is None: self.unknown_charref(name) else: self.handle_data(replacement)
Handle character reference, no need to override.
handle_charref
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sgmllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sgmllib.py
MIT
def convert_entityref(self, name): """Convert entity references. As an alternative to overriding this method; one can tailor the results by setting up the self.entitydefs mapping appropriately. """ table = self.entitydefs if name in table: return table[name] ...
Convert entity references. As an alternative to overriding this method; one can tailor the results by setting up the self.entitydefs mapping appropriately.
convert_entityref
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sgmllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sgmllib.py
MIT
def handle_entityref(self, name): """Handle entity references, no need to override.""" replacement = self.convert_entityref(name) if replacement is None: self.unknown_entityref(name) else: self.handle_data(replacement)
Handle entity references, no need to override.
handle_entityref
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/sgmllib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sgmllib.py
MIT
def push_token(self, tok): "Push a token onto the stack popped by the get_token method" if self.debug >= 1: print "shlex: pushing token " + repr(tok) self.pushback.appendleft(tok)
Push a token onto the stack popped by the get_token method
push_token
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shlex.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shlex.py
MIT
def push_source(self, newstream, newfile=None): "Push an input source onto the lexer's input source stack." if isinstance(newstream, basestring): newstream = StringIO(newstream) self.filestack.appendleft((self.infile, self.instream, self.lineno)) self.infile = newfile ...
Push an input source onto the lexer's input source stack.
push_source
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shlex.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shlex.py
MIT
def get_token(self): "Get a token from the input stream (or from stack if it's nonempty)" if self.pushback: tok = self.pushback.popleft() if self.debug >= 1: print "shlex: popping token " + repr(tok) return tok # No pushback. Get a token. ...
Get a token from the input stream (or from stack if it's nonempty)
get_token
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shlex.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shlex.py
MIT
def sourcehook(self, newfile): "Hook called on a filename to be sourced." if newfile[0] == '"': newfile = newfile[1:-1] # This implements cpp-like semantics for relative-path inclusion. if isinstance(self.infile, basestring) and not os.path.isabs(newfile): newfile...
Hook called on a filename to be sourced.
sourcehook
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shlex.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shlex.py
MIT
def copyfileobj(fsrc, fdst, length=16*1024): """copy data from file-like object fsrc to file-like object fdst""" while 1: buf = fsrc.read(length) if not buf: break fdst.write(buf)
copy data from file-like object fsrc to file-like object fdst
copyfileobj
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copyfile(src, dst): """Copy data from src to dst""" if _samefile(src, dst): raise Error("`%s` and `%s` are the same file" % (src, dst)) for fn in [src, dst]: try: st = os.stat(fn) except OSError: # File most likely does not exist pass ...
Copy data from src to dst
copyfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copymode(src, dst): """Copy mode bits from src to dst""" if hasattr(os, 'chmod'): st = os.stat(src) mode = stat.S_IMODE(st.st_mode) os.chmod(dst, mode)
Copy mode bits from src to dst
copymode
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copystat(src, dst): """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): os.chmod(dst, mode) if hasattr(os, 'chfl...
Copy all stat info (mode bits, atime, mtime, flags) from src to dst
copystat
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copy(src, dst): """Copy data and mode bits ("cp src dst"). The destination may be a directory. """ if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) copyfile(src, dst) copymode(src, dst)
Copy data and mode bits ("cp src dst"). The destination may be a directory.
copy
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copy2(src, dst): """Copy data and all stat info ("cp -p src dst"). The destination may be a directory. """ if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) copyfile(src, dst) copystat(src, dst)
Copy data and all stat info ("cp -p src dst"). The destination may be a directory.
copy2
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def ignore_patterns(*patterns): """Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files""" def _ignore_patterns(path, names): ignored_names = [] for pattern in patterns: ignored_names.extend(fn...
Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files
ignore_patterns
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def copytree(src, dst, symlinks=False, ignore=None): """Recursively copy a directory tree using copy2(). The destination directory must not already exist. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree resu...
Recursively copy a directory tree using copy2(). The destination directory must not already exist. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is f...
copytree
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def rmtree(path, ignore_errors=False, onerror=None): """Recursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is os.listdir, os.remove, or os.rmdir; path is th...
Recursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is os.listdir, os.remove, or os.rmdir; path is the argument to that function that caused it to fail; and ...
rmtree
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def move(src, dst): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination al...
Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a d...
move
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def _get_uid(name): """Returns an uid, given a user name.""" if getpwnam is None or name is None: return None try: result = getpwnam(name) except KeyError: result = None if result is not None: return result[2] return None
Returns an uid, given a user name.
_get_uid
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None, logger=None): """Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", or None. 'owner' and 'group' can be us...
Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. ...
_make_tarball
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on th...
Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises ExecError. Retu...
_make_zipfile
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def get_archive_formats(): """Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) """ formats = [(name, registry[2]) for name, registry in _ARCHIVE_FORMATS.items()] formats.sort() return formats
Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description)
get_archive_formats
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def register_archive_format(name, function, extra_args=None, description=''): """Registers an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to ...
Registers an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be ret...
register_archive_format
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0, owner=None, group=None, logger=None): """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one ...
Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "bztar" or "gztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir int...
make_archive
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/shutil.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/shutil.py
MIT
def send_head(self): """Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all cir...
Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in...
send_head
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleHTTPServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleHTTPServer.py
MIT
def list_directory(self, path): """Helper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). """ try: ...
Helper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head().
list_directory
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleHTTPServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleHTTPServer.py
MIT
def translate_path(self, path): """Translate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) """ # abandon query paramete...
Translate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.)
translate_path
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleHTTPServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleHTTPServer.py
MIT
def guess_type(self, path): """Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map...
Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream ...
guess_type
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleHTTPServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleHTTPServer.py
MIT
def resolve_dotted_attribute(obj, attr, allow_dotted_names=True): """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. If the optional allow_dotted_names argument is false, dots are ...
resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. If the optional allow_dotted_names argument is false, dots are not supported and this function operates similar to getattr(obj, attr...
resolve_dotted_attribute
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def list_public_methods(obj): """Returns a list of attribute strings, found in the specified object, which represent callable attributes""" return [member for member in dir(obj) if not member.startswith('_') and hasattr(getattr(obj, member), '__call__')]
Returns a list of attribute strings, found in the specified object, which represent callable attributes
list_public_methods
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def remove_duplicates(lst): """remove_duplicates([2,2,2,1,3,3]) => [3,1,2] Returns a copy of a list without duplicates. Every list item must be hashable and the order of the items in the resulting list is not defined. """ u = {} for x in lst: u[x] = 1 return u.keys()
remove_duplicates([2,2,2,1,3,3]) => [3,1,2] Returns a copy of a list without duplicates. Every list item must be hashable and the order of the items in the resulting list is not defined.
remove_duplicates
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def register_instance(self, instance, allow_dotted_names=False): """Registers an instance to respond to XML-RPC requests. Only one instance can be installed at a time. If the registered instance has a _dispatch method then that method will be called with the name of the XML-RPC method ...
Registers an instance to respond to XML-RPC requests. Only one instance can be installed at a time. If the registered instance has a _dispatch method then that method will be called with the name of the XML-RPC method and its parameters as a tuple e.g. instance._dispatch('add',...
register_instance
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def register_function(self, function, name = None): """Registers a function to respond to XML-RPC requests. The optional name argument can be used to set a Unicode name for the function. """ if name is None: name = function.__name__ self.funcs[name] = functi...
Registers a function to respond to XML-RPC requests. The optional name argument can be used to set a Unicode name for the function.
register_function
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def register_introspection_functions(self): """Registers the XML-RPC introspection methods in the system namespace. see http://xmlrpc.usefulinc.com/doc/reserved.html """ self.funcs.update({'system.listMethods' : self.system_listMethods, 'system.methodSigna...
Registers the XML-RPC introspection methods in the system namespace. see http://xmlrpc.usefulinc.com/doc/reserved.html
register_introspection_functions
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def _marshaled_dispatch(self, data, dispatch_method = None, path = None): """Dispatches an XML-RPC method from marshalled (XML) data. XML-RPC methods are dispatched from the marshalled (XML) data using the _dispatch method and the result is returned as marshalled data. For backwards com...
Dispatches an XML-RPC method from marshalled (XML) data. XML-RPC methods are dispatched from the marshalled (XML) data using the _dispatch method and the result is returned as marshalled data. For backwards compatibility, a dispatch function can be provided as an argument (see comment i...
_marshaled_dispatch
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def system_listMethods(self): """system.listMethods() => ['add', 'subtract', 'multiple'] Returns a list of the methods supported by the server.""" methods = self.funcs.keys() if self.instance is not None: # Instance can implement _listMethod to return a list of ...
system.listMethods() => ['add', 'subtract', 'multiple'] Returns a list of the methods supported by the server.
system_listMethods
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def system_methodSignature(self, method_name): """system.methodSignature('add') => [double, int, int] Returns a list describing the signature of the method. In the above example, the add method takes two integers as arguments and returns a double result. This server does NOT su...
system.methodSignature('add') => [double, int, int] Returns a list describing the signature of the method. In the above example, the add method takes two integers as arguments and returns a double result. This server does NOT support system.methodSignature.
system_methodSignature
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def system_methodHelp(self, method_name): """system.methodHelp('add') => "Adds two integers together" Returns a string containing documentation for the specified method.""" method = None if method_name in self.funcs: method = self.funcs[method_name] elif self.instan...
system.methodHelp('add') => "Adds two integers together" Returns a string containing documentation for the specified method.
system_methodHelp
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def system_multicall(self, call_list): """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \ [[4], ...] Allows the caller to package multiple XML-RPC calls into a single request. See http://www.xmlrpc.com/discuss/msgReader$1208 """ results = [] ...
system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...] Allows the caller to package multiple XML-RPC calls into a single request. See http://www.xmlrpc.com/discuss/msgReader$1208
system_multicall
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def _dispatch(self, method, params): """Dispatches the XML-RPC method. XML-RPC calls are forwarded to a registered function that matches the called XML-RPC method name. If no such function exists then the call is forwarded to the registered instance, if available. If th...
Dispatches the XML-RPC method. XML-RPC calls are forwarded to a registered function that matches the called XML-RPC method name. If no such function exists then the call is forwarded to the registered instance, if available. If the registered instance has a _dispatch method the...
_dispatch
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def do_POST(self): """Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. """ # Check that the path is legal if not self.is_rpc_path_valid(): self.re...
Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling.
do_POST
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def handle_get(self): """Handle a single HTTP GET request. Default implementation indicates an error because XML-RPC uses the POST method. """ code = 400 message, explain = \ BaseHTTPServer.BaseHTTPRequestHandler.responses[code] response = Base...
Handle a single HTTP GET request. Default implementation indicates an error because XML-RPC uses the POST method.
handle_get
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def handle_request(self, request_text = None): """Handle a single XML-RPC request passed through a CGI post method. If no XML data is given then it is read from stdin. The resulting XML-RPC response is printed to stdout along with the correct HTTP headers. """ if reques...
Handle a single XML-RPC request passed through a CGI post method. If no XML data is given then it is read from stdin. The resulting XML-RPC response is printed to stdout along with the correct HTTP headers.
handle_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SimpleXMLRPCServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SimpleXMLRPCServer.py
MIT
def abs__file__(): """Set all module' __file__ attribute to an absolute path""" for m in sys.modules.values(): if hasattr(m, '__loader__'): continue # don't mess with a PEP 302-supplied __file__ try: m.__file__ = os.path.abspath(m.__file__) except (AttributeErro...
Set all module' __file__ attribute to an absolute path
abs__file__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def addpackage(sitedir, name, known_paths): """Process a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. """ if known_paths is None: _init_pathinfo(...
Process a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '.
addpackage
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: known_paths = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase i...
Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'
addsitedir
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def check_enableusersite(): """Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe a...
Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabled
check_enableusersite
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def getuserbase(): """Returns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it. """ global USER_BASE if USER_BASE is not None: return USER_BASE from sy...
Returns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it.
getuserbase
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: ...
Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it.
getusersitepackages
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def addusersitepackages(known_paths): """Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. """ # get the per user site-package path # this call will also make sure USER_BASE and USER_SITE are set user_site = getusersitep...
Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory.
addusersitepackages
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def getsitepackages(): """Returns a list containing all global site-packages directories (and possibly site-python). For each directory present in the global ``PREFIXES``, this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full pa...
Returns a list containing all global site-packages directories (and possibly site-python). For each directory present in the global ``PREFIXES``, this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full paths.
getsitepackages
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def addsitepackages(known_paths): """Add site-packages (and possibly site-python) to sys.path""" for sitedir in getsitepackages(): if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) return known_paths
Add site-packages (and possibly site-python) to sys.path
addsitepackages
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def setquit(): """Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. """ if os.sep == ':': eof = 'Cmd-Q' elif os.sep == '\\': eof = 'Ctrl-Z plus Return' else: ...
Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works.
setquit
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def setencoding(): """Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this.""" encoding = "ascii" # Default value set by _PyUnicode_Init() if 0: # Enable to support locale aware default string encodings....
Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this.
setencoding
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def execsitecustomize(): """Run custom site specific code, if available.""" try: import sitecustomize except ImportError: pass except Exception: if sys.flags.verbose: sys.excepthook(*sys.exc_info()) else: print >>sys.stderr, \ "'imp...
Run custom site specific code, if available.
execsitecustomize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def execusercustomize(): """Run custom user specific code, if available.""" try: import usercustomize except ImportError: pass except Exception: if sys.flags.verbose: sys.excepthook(*sys.exc_info()) else: print>>sys.stderr, \ "'impo...
Run custom user specific code, if available.
execusercustomize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/site.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/site.py
MIT
def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything rfc822.parseaddr can handle. """ m = (None, None) try: m = email.utils.parseaddr(addr)[1] except AttributeError: pass if m == (None, None): # Indicates parse ...
Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything rfc822.parseaddr can handle.
quoteaddr
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\\n', or Mac '\\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line.
quotedata
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def __init__(self, host='', port=0, local_hostname=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Initialize a new instance. If specified, `host' is the name of the remote host to which to connect. If specified, `port' specifies the port to which to connect. By defa...
Initialize a new instance. If specified, `host' is the name of the remote host to which to connect. If specified, `port' specifies the port to which to connect. By default, smtplib.SMTP_PORT is used. If a host is specified the connect method is called, and if it returns anything other...
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def connect(self, host='localhost', port=0): """Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This met...
Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This method is automatically invoked by __init__, if a host is ...
connect
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def getreply(self): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (multiline ...
Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (multiline responses are converted to...
getreply
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("helo", name or self.local_hostname) (code, msg) = self.getreply() self.helo_resp = msg return (code, msg)
SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host.
helo
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.esmtp_features = {} self.putcmd(self.ehlo_msg, name or self.local_hostname) (code, msg) = self.getreply() # According to RF...
SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host.
ehlo
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def mail(self, sender, options=[]): """SMTP 'mail' command -- begins mail xfer session.""" optionlist = '' if options and self.does_esmtp: optionlist = ' ' + ' '.join(options) self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender), optionlist)) return self.getreply()
SMTP 'mail' command -- begins mail xfer session.
mail
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def rcpt(self, recip, options=[]): """SMTP 'rcpt' command -- indicates 1 recipient for this mail.""" optionlist = '' if options and self.does_esmtp: optionlist = ' ' + ' '.join(options) self.putcmd("rcpt", "TO:%s%s" % (quoteaddr(recip), optionlist)) return self.getrep...
SMTP 'rcpt' command -- indicates 1 recipient for this mail.
rcpt
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def data(self, msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. Raises SMTPDataError if there is an unexpected reply to the DATA command; the return value from this method is the final response code rece...
SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. Raises SMTPDataError if there is an unexpected reply to the DATA command; the return value from this method is the final response code received when the all data is sent. ...
data
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def ehlo_or_helo_if_needed(self): """Call self.ehlo() and/or self.helo() if needed. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method may raise the following exceptions: SMTPHeloError The server didn't ...
Call self.ehlo() and/or self.helo() if needed. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to ...
ehlo_or_helo_if_needed
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def login(self, user, password): """Log in on an SMTP server that requires authentication. The arguments are: - user: The user name to authenticate with. - password: The password for the authentication. If there has been no previous EHLO or HELO command this session...
Log in on an SMTP server that requires authentication. The arguments are: - user: The user name to authenticate with. - password: The password for the authentication. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first...
login
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def starttls(self, keyfile=None, certfile=None): """Puts the connection to the SMTP server into TLS mode. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server supports TLS, this will encrypt the rest of the SMTP sess...
Puts the connection to the SMTP server into TLS mode. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server supports TLS, this will encrypt the rest of the SMTP session. If you provide the keyfile and certfile parameters, ...
starttls
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : A list of addresses to send this mail to. A ...
This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : A list of addresses to send this mail to. A bare string will be treated as a list with 1 address. - msg ...
sendmail
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def close(self): """Close the connection to the SMTP server.""" try: file = self.file self.file = None if file: file.close() finally: sock = self.sock self.sock = None if sock: sock.close()
Close the connection to the SMTP server.
close
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def connect(self, host='localhost', port=0): """Connect to the LMTP daemon, on either a Unix or a TCP socket.""" if host[0] != '/': return SMTP.connect(self, host, port) # Handle Unix-domain sockets. try: self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STRE...
Connect to the LMTP daemon, on either a Unix or a TCP socket.
connect
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/smtplib.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/smtplib.py
MIT
def getfqdn(name=''): """Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname from gethostname() is returned. """ ...
Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname from gethostname() is returned.
getfqdn
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/socket.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/socket.py
MIT
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parame...
Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the...
create_connection
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/socket.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/socket.py
MIT
def _eintr_retry(func, *args): """restart a system call interrupted by EINTR""" while True: try: return func(*args) except (OSError, select.error) as e: if e.args[0] != errno.EINTR: raise
restart a system call interrupted by EINTR
_eintr_retry
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" self.server_address = server_address self.RequestHandlerClass = RequestHandlerClass self.__is_shut_down = threading.Event() self.__shutdown_request = False
Constructor. May be extended, do not override.
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def serve_forever(self, poll_interval=0.5): """Handle one request at a time until shutdown. Polls for shutdown every poll_interval seconds. Ignores self.timeout. If you need to do periodic tasks, do them in another thread. """ self.__is_shut_down.clear() try: ...
Handle one request at a time until shutdown. Polls for shutdown every poll_interval seconds. Ignores self.timeout. If you need to do periodic tasks, do them in another thread.
serve_forever
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def handle_request(self): """Handle one request, possibly blocking. Respects self.timeout. """ # Support people who used socket.settimeout() to escape # handle_request before self.timeout was available. timeout = self.socket.gettimeout() if timeout is None: ...
Handle one request, possibly blocking. Respects self.timeout.
handle_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def _handle_request_noblock(self): """Handle one request, without blocking. I assume that select.select has returned that the socket is readable before this function was called, so there should be no risk of blocking in get_request(). """ try: request, client...
Handle one request, without blocking. I assume that select.select has returned that the socket is readable before this function was called, so there should be no risk of blocking in get_request().
_handle_request_noblock
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden. The default is to print a traceback and continue. """ print '-'*40 print 'Exception happened during processing of request from', print client_address import trace...
Handle an error gracefully. May be overridden. The default is to print a traceback and continue.
handle_error
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) self.socket = socket.socket(self.address_family, self.socket_t...
Constructor. May be extended, do not override.
__init__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def server_bind(self): """Called by constructor to bind the socket. May be overridden. """ if self.allow_reuse_address: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(self.server_address) self.server_address = self.socket....
Called by constructor to bind the socket. May be overridden.
server_bind
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def shutdown_request(self, request): """Called to shutdown and close an individual request.""" try: #explicitly shutdown. socket.close() merely releases #the socket and waits for GC to perform the actual close. request.shutdown(socket.SHUT_WR) except socket.e...
Called to shutdown and close an individual request.
shutdown_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def collect_children(self): """Internal routine to wait for children that have exited.""" if self.active_children is None: return # If we're above the max number of children, wait and reap them until # we go back below threshold. Note that we use waitpid(-1) below to be ...
Internal routine to wait for children that have exited.
collect_children
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = set() self....
Fork a new subprocess to process the request.
process_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread. In addition, exception handling is done here. """ try: self.finish_request(request, client_address) self.shutdown_request(request) except: se...
Same as in BaseServer but as a thread. In addition, exception handling is done here.
process_request_thread
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def process_request(self, request, client_address): """Start a new thread to process the request.""" t = threading.Thread(target = self.process_request_thread, args = (request, client_address)) t.daemon = self.daemon_threads t.start()
Start a new thread to process the request.
process_request
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/SocketServer.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/SocketServer.py
MIT
def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False pieces = dn.split(r'.') leftmost = pieces[0] remainder = pieces[1:] wildcards = leftmo...
Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3
_dnsname_match
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function r...
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing.
match_hostname
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_default_verify_paths(): """Return paths to default cafile and capath. """ parts = _ssl.get_default_verify_paths() # environment vars shadow paths cafile = os.environ.get(parts[0], parts[1]) capath = os.environ.get(parts[2], parts[3]) return DefaultVerifyPaths(cafile if os.path.isfi...
Return paths to default cafile and capath.
get_default_verify_paths
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None): """Create a SSLContext object with default settings. NOTE: The protocol and settings may change anytime without prior deprecation. The values represent a fair balance between max...
Create a SSLContext object with default settings. NOTE: The protocol and settings may change anytime without prior deprecation. The values represent a fair balance between maximum compatibility and security.
create_default_context
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def _create_unverified_context(protocol=PROTOCOL_SSLv23, cert_reqs=None, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): """Create a SSLContext object for Python s...
Create a SSLContext object for Python stdlib modules All Python stdlib modules shall use this function to create SSLContext objects in order to keep common settings in one place. The configuration is less restrict than create_default_context()'s to increase backward compatibility.
_create_unverified_context
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def _https_verify_certificates(enable=True): """Verify server HTTPS certificates by default?""" global _create_default_https_context if enable: _create_default_https_context = create_default_context else: _create_default_https_context = _create_unverified_context
Verify server HTTPS certificates by default?
_https_verify_certificates
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def read(self, len=1024, buffer=None): """Read up to LEN bytes and return them. Return zero-length string on EOF.""" self._checkClosed() if not self._sslobj: raise ValueError("Read on closed or unwrapped SSL socket.") try: if buffer is not None: ...
Read up to LEN bytes and return them. Return zero-length string on EOF.
read
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def getpeercert(self, binary_form=False): """Returns a formatted version of the data in the certificate provided by the other end of the SSL channel. Return None if no certificate was provided, {} if a certificate was provided, but not validated.""" self._checkClosed() s...
Returns a formatted version of the data in the certificate provided by the other end of the SSL channel. Return None if no certificate was provided, {} if a certificate was provided, but not validated.
getpeercert
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT
def accept(self): """Accepts a new connection from a remote client, and returns a tuple containing that new connection wrapped with a server-side SSL channel, and the address of the remote client.""" newsock, addr = socket.accept(self) newsock = self.context.wrap_socket(newsock,...
Accepts a new connection from a remote client, and returns a tuple containing that new connection wrapped with a server-side SSL channel, and the address of the remote client.
accept
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/ssl.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py
MIT