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 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/pylibs/osx64/gevent/_ssl3.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_ssl3.py | MIT |
def version(self):
"""Return a string identifying the protocol version used by the
current SSL channel. """
if not self._sslobj:
return None
return self._sslobj.version() | Return a string identifying the protocol version used by the
current SSL channel. | version | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/gevent/_ssl3.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_ssl3.py | MIT |
def get_channel_binding(self, cb_type="tls-unique"):
"""Get channel binding data for current connection. Raise ValueError
if the requested `cb_type` is not supported. Return bytes of the data
or None if the data is not available (e.g. before the handshake).
"""
if cb_type not i... | Get channel binding data for current connection. Raise ValueError
if the requested `cb_type` is not supported. Return bytes of the data
or None if the data is not available (e.g. before the handshake).
| get_channel_binding | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/gevent/_ssl3.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_ssl3.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/pylibs/osx64/gevent/_sslgte279.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_sslgte279.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/pylibs/osx64/gevent/_sslgte279.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_sslgte279.py | MIT |
def version(self):
"""
Return a string identifying the protocol version used by the
current SSL channel, or None if there is no established channel.
"""
if self._sslobj is None:
return None
return self._sslobj.version() |
Return a string identifying the protocol version used by the
current SSL channel, or None if there is no established channel.
| version | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/gevent/_sslgte279.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/gevent/_sslgte279.py | MIT |
def __new__(self, projparams=None, preserve_units=False, **kwargs):
"""
initialize a Proj class instance.
Proj4 projection control parameters must either be given in a
dictionary 'projparams' or as keyword arguments. See the proj
documentation (http://trac.osgeo.org/proj/) for m... |
initialize a Proj class instance.
Proj4 projection control parameters must either be given in a
dictionary 'projparams' or as keyword arguments. See the proj
documentation (http://trac.osgeo.org/proj/) for more information
about specifying projection parameters.
Exampl... | __new__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def __call__(self, *args, **kw):
#,lon,lat,inverse=False,radians=False,errcheck=False):
"""
Calling a Proj class instance with the arguments lon, lat will
convert lon/lat (in degrees) to x/y native map projection
coordinates (in meters). If optional keyword 'inverse' is True
... |
Calling a Proj class instance with the arguments lon, lat will
convert lon/lat (in degrees) to x/y native map projection
coordinates (in meters). If optional keyword 'inverse' is True
(default is False), the inverse transformation from x/y to
lon/lat is performed. If optional ... | __call__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def transform(p1, p2, x, y, z=None, radians=False):
"""
x2, y2, z2 = transform(p1, p2, x1, y1, z1, radians=False)
Transform points between two coordinate systems defined by the
Proj instances p1 and p2.
The points x1,y1,z1 in the coordinate system defined by p1 are
transformed to x2,y2,z2 in t... |
x2, y2, z2 = transform(p1, p2, x1, y1, z1, radians=False)
Transform points between two coordinate systems defined by the
Proj instances p1 and p2.
The points x1,y1,z1 in the coordinate system defined by p1 are
transformed to x2,y2,z2 in the coordinate system defined by p2.
z1 is optional, if... | transform | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def _copytobuffer(x):
"""
return a copy of x as an object that supports the python Buffer
API (python array if input is float, list or tuple, numpy array
if input is a numpy array). returns copyofx, isfloat, islist,
istuple (islist is True if input is a list, istuple is true if
input is a tuple,... |
return a copy of x as an object that supports the python Buffer
API (python array if input is float, list or tuple, numpy array
if input is a numpy array). returns copyofx, isfloat, islist,
istuple (islist is True if input is a list, istuple is true if
input is a tuple, isfloat is true if input is ... | _copytobuffer | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def __new__(self, initstring=None, **kwargs):
"""
initialize a Geod class instance.
Geodetic parameters for specifying the ellipsoid
can be given in a dictionary 'initparams', as keyword arguments,
or as as proj4 geod initialization string.
Following is a list of the ell... |
initialize a Geod class instance.
Geodetic parameters for specifying the ellipsoid
can be given in a dictionary 'initparams', as keyword arguments,
or as as proj4 geod initialization string.
Following is a list of the ellipsoids that may be defined using the
'ellps' key... | __new__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def fwd(self, lons, lats, az, dist, radians=False):
"""
forward transformation - Returns longitudes, latitudes and back
azimuths of terminus points given longitudes (lons) and
latitudes (lats) of initial points, plus forward azimuths (az)
and distances (dist).
latitudes (... |
forward transformation - Returns longitudes, latitudes and back
azimuths of terminus points given longitudes (lons) and
latitudes (lats) of initial points, plus forward azimuths (az)
and distances (dist).
latitudes (lats) of initial points, plus forward azimuths (az)
and... | fwd | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def inv(self,lons1,lats1,lons2,lats2,radians=False):
"""
inverse transformation - Returns forward and back azimuths, plus
distances between initial points (specified by lons1, lats1) and
terminus points (specified by lons2, lats2).
Works with numpy and regular python array objec... |
inverse transformation - Returns forward and back azimuths, plus
distances between initial points (specified by lons1, lats1) and
terminus points (specified by lons2, lats2).
Works with numpy and regular python array objects, python
sequences and scalars.
if radians=Tr... | inv | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def npts(self, lon1, lat1, lon2, lat2, npts, radians=False):
"""
Given a single initial point and terminus point (specified by
python floats lon1,lat1 and lon2,lat2), returns a list of
longitude/latitude pairs describing npts equally spaced
intermediate points along the geodesic ... |
Given a single initial point and terminus point (specified by
python floats lon1,lat1 and lon2,lat2), returns a list of
longitude/latitude pairs describing npts equally spaced
intermediate points along the geodesic between the initial and
terminus points.
if radians=Tru... | npts | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/pyproj/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/osx64/pyproj/__init__.py | MIT |
def check_access_token(self):
"""
Add few seconds to now so the token get refreshed
before it invalidates in the middle of the request
"""
now_s = get_time() + 120
if self._access_token is not None:
if self._access_token_expiry == 0:
self.log... |
Add few seconds to now so the token get refreshed
before it invalidates in the middle of the request
| check_access_token | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/shared/pgoapi/auth.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/shared/pgoapi/auth.py | MIT |
def dict_to_protobuf(pb_klass_or_instance, values, type_callable_map=REVERSE_TYPE_CALLABLE_MAP, strict=True):
"""Populates a protobuf model from a dictionary.
:param pb_klass_or_instance: a protobuf message class, or an protobuf instance
:type pb_klass_or_instance: a type or instance of a subclass of googl... | Populates a protobuf model from a dictionary.
:param pb_klass_or_instance: a protobuf message class, or an protobuf instance
:type pb_klass_or_instance: a type or instance of a subclass of google.protobuf.message.Message
:param dict values: a dictionary of values. Repeated and nested values are
full... | dict_to_protobuf | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/shared/pgoapi/protobuf_to_dict.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/shared/pgoapi/protobuf_to_dict.py | MIT |
def long_to_bytes(val, endianness='big'):
"""
Use :ref:`string formatting` and :func:`~binascii.unhexlify` to
convert ``val``, a :func:`long`, to a byte :func:`str`.
:param long val: The value to pack
:param str endianness: The endianness of the result. ``'big'`` for
big-endian, ``'little'`` f... |
Use :ref:`string formatting` and :func:`~binascii.unhexlify` to
convert ``val``, a :func:`long`, to a byte :func:`str`.
:param long val: The value to pack
:param str endianness: The endianness of the result. ``'big'`` for
big-endian, ``'little'`` for little-endian.
If you want byte- and word-... | long_to_bytes | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/shared/pgoapi/utilities.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/shared/pgoapi/utilities.py | MIT |
def b64decode(s, altchars=None):
"""Decode a Base64 encoded string.
s is the string to decode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies the
alternative alphabet used instead of the '+' and '/' characters.
The decoded string is ret... | Decode a Base64 encoded string.
s is the string to decode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies the
alternative alphabet used instead of the '+' and '/' characters.
The decoded string is returned. A TypeError is raised if s is
... | b64decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/base64.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/base64.py | MIT |
def b16decode(s, casefold=False):
"""Decode a Base16 encoded string.
s is the string to decode. Optional casefold is a flag specifying whether
a lowercase alphabet is acceptable as input. For security purposes, the
default is False.
The decoded string is returned. A TypeError is raised if s is
... | Decode a Base16 encoded string.
s is the string to decode. Optional casefold is a flag specifying whether
a lowercase alphabet is acceptable as input. For security purposes, the
default is False.
The decoded string is returned. A TypeError is raised if s is
incorrectly padded or if there are no... | b16decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/base64.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/base64.py | MIT |
def get_grouped_opcodes(self, n=3):
""" Isolate change clusters by eliminating ranges with no changes.
Return a generator of groups with up to n lines of context.
Each group is in the same format as returned by get_opcodes().
>>> from pprint import pprint
>>> a = map(str, range... | Isolate change clusters by eliminating ranges with no changes.
Return a generator of groups with up to n lines of context.
Each group is in the same format as returned by get_opcodes().
>>> from pprint import pprint
>>> a = map(str, range(1,40))
>>> b = a[:]
>>> b[8:8]... | get_grouped_opcodes | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/difflib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/difflib.py | MIT |
def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None):
"""Store a file in binary mode. A new port is created for you.
Args:
cmd: A STOR command.
fp: A file-like object with a read(num_bytes) method.
blocksize: The maximum data size to read from fp and se... | Store a file in binary mode. A new port is created for you.
Args:
cmd: A STOR command.
fp: A file-like object with a read(num_bytes) method.
blocksize: The maximum data size to read from fp and send over
the connection at once. [default: 8192]
call... | storbinary | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ftplib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ftplib.py | MIT |
def storlines(self, cmd, fp, callback=None):
"""Store a file in line mode. A new port is created for you.
Args:
cmd: A STOR command.
fp: A file-like object with a readline() method.
callback: An optional single parameter callable that is called on
each... | Store a file in line mode. A new port is created for you.
Args:
cmd: A STOR command.
fp: A file-like object with a readline() method.
callback: An optional single parameter callable that is called on
each line after it is sent. [default: None]
Return... | storlines | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ftplib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ftplib.py | MIT |
def iglob(pathname):
"""Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
"""
dirna... | Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
| iglob | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/glob.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/glob.py | MIT |
def set_tunnel(self, host, port=None, headers=None):
""" Set up host and port for HTTP CONNECT tunnelling.
In a connection that uses HTTP Connect tunneling, the host passed to the
constructor is used as proxy server that relays all communication to the
endpoint passed to set_tunnel. Thi... | Set up host and port for HTTP CONNECT tunnelling.
In a connection that uses HTTP Connect tunneling, the host passed to the
constructor is used as proxy server that relays all communication to the
endpoint passed to set_tunnel. This is done by sending a HTTP CONNECT
request to the proxy... | set_tunnel | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/httplib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/httplib.py | MIT |
def endheaders(self, message_body=None):
"""Indicate that the last header line has been sent to the server.
This method sends the request to the server. The optional
message_body argument can be used to pass a message body
associated with the request. The message body will be sent in
... | Indicate that the last header line has been sent to the server.
This method sends the request to the server. The optional
message_body argument can be used to pass a message body
associated with the request. The message body will be sent in
the same packet as the message headers if it... | endheaders | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/httplib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/httplib.py | MIT |
def split(s):
"""Split a pathname into two parts: the directory leading up to the final
bit, and the basename (the filename, without colons, in that directory).
The result (s, t) is such that join(s, t) yields the original argument."""
if ':' not in s: return '', s
colon = 0
for i in range(len(... | Split a pathname into two parts: the directory leading up to the final
bit, and the basename (the filename, without colons, in that directory).
The result (s, t) is such that join(s, t) yields the original argument. | split | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/macpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/macpath.py | MIT |
def islink(s):
"""Return true if the pathname refers to a symbolic link."""
try:
import Carbon.File
return Carbon.File.ResolveAliasFile(s, 0)[2]
except:
return False | Return true if the pathname refers to a symbolic link. | islink | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/macpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/macpath.py | MIT |
def normpath(s):
"""Normalize a pathname. Will return the same result for
equivalent paths."""
if ":" not in s:
return ":"+s
comps = s.split(":")
i = 1
while i < len(comps)-1:
if comps[i] == "" and comps[i-1] != "":
if i > 1:
del comps[i-1:i+1]
... | Normalize a pathname. Will return the same result for
equivalent paths. | normpath | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/macpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/macpath.py | MIT |
def splitunc(p):
"""Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters neve... | Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have a UNC part.
| splitunc | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ntpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ntpath.py | MIT |
def join(a, *p):
"""Join two or more pathname components, inserting sep as needed"""
path = a
for b in p:
if isabs(b):
path = b
elif path == '' or path[-1:] in '/\\:':
path = path + b
else:
path = path + '/' + b
return path | Join two or more pathname components, inserting sep as needed | join | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/os2emxpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/os2emxpath.py | MIT |
def abspath(path):
"""Return the absolute version of a path"""
if not isabs(path):
if isinstance(path, _unicode):
cwd = os.getcwdu()
else:
cwd = os.getcwd()
path = join(cwd, path)
return normpath(path) | Return the absolute version of a path | abspath | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/os2emxpath.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/os2emxpath.py | MIT |
def formatdate(timeval=None):
"""Returns time format preferred for Internet standards.
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
According to RFC 1123, day and month names must always be in
English. If not for that, this code could use strftime(). It
can't because strftime() ... | Returns time format preferred for Internet standards.
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
According to RFC 1123, day and month names must always be in
English. If not for that, this code could use strftime(). It
can't because strftime() honors the locale and could generate
... | formatdate | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/rfc822.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/rfc822.py | MIT |
def attr_matches(self, text):
"""Compute matches when text contains a dot.
Assuming the text is of the form NAME.NAME....[NAME], and is
evaluable in self.namespace, it will be evaluated and its attributes
(as revealed by dir()) are used as possible completions. (For class
insta... | Compute matches when text contains a dot.
Assuming the text is of the form NAME.NAME....[NAME], and is
evaluable in self.namespace, it will be evaluated and its attributes
(as revealed by dir()) are used as possible completions. (For class
instances, class members are also considered.)... | attr_matches | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/rlcompleter.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/rlcompleter.py | MIT |
def run(self):
"""Execute events until the queue is empty.
When there is a positive delay until the first event, the
delay function is called and the event is left in the queue;
otherwise, the event is removed from the queue and executed
(its action function is called, passing i... | Execute events until the queue is empty.
When there is a positive delay until the first event, the
delay function is called and the event is left in the queue;
otherwise, the event is removed from the queue and executed
(its action function is called, passing it the argument). If
... | run | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/sched.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sched.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 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 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 _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 cert_time_to_seconds(cert_time):
"""Return the time in seconds since the Epoch, given the timestring
representing the "notBefore" or "notAfter" date from a certificate
in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).
"notBefore" or "notAfter" dates must use UTC (RFC 5280).
Month is on... | Return the time in seconds since the Epoch, given the timestring
representing the "notBefore" or "notAfter" date from a certificate
in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).
"notBefore" or "notAfter" dates must use UTC (RFC 5280).
Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oc... | cert_time_to_seconds | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ssl.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ssl.py | MIT |
def _args_from_interpreter_flags():
"""Return a list of command-line arguments reproducing the current
settings in sys.flags and sys.warnoptions."""
flag_opt_map = {
'debug': 'd',
# 'inspect': 'i',
# 'interactive': 'i',
'optimize': 'O',
'dont_write_bytecode': 'B',
... | Return a list of command-line arguments reproducing the current
settings in sys.flags and sys.warnoptions. | _args_from_interpreter_flags | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/subprocess.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py | MIT |
def check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.
If the exit code was non-zero it raises a CalledProcessError. The
CalledProcessError object will have the return code in the returncode
attribute and output in the output attribute.
The ... | Run command with arguments and return its output as a byte string.
If the exit code was non-zero it raises a CalledProcessError. The
CalledProcessError object will have the return code in the returncode
attribute and output in the output attribute.
The arguments are the same as for the Popen construc... | check_output | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/subprocess.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/subprocess.py | MIT |
def gethdr(fp):
"""Read a sound header from an open file."""
if fp.read(4) != MAGIC:
raise error, 'gethdr: bad magic word'
hdr_size = get_long_be(fp.read(4))
data_size = get_long_be(fp.read(4))
encoding = get_long_be(fp.read(4))
sample_rate = get_long_be(fp.read(4))
channels = get_lo... | Read a sound header from an open file. | gethdr | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/sunaudio.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sunaudio.py | MIT |
def printhdr(file):
"""Read and print the sound header of a named file."""
hdr = gethdr(open(file, 'r'))
data_size, encoding, sample_rate, channels, info = hdr
while info[-1:] == '\0':
info = info[:-1]
print 'File name: ', file
print 'Data size: ', data_size
print 'Encoding: ', e... | Read and print the sound header of a named file. | printhdr | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/sunaudio.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/sunaudio.py | MIT |
def gettarinfo(self, name=None, arcname=None, fileobj=None):
"""Create a TarInfo object from the result of os.stat or equivalent
on an existing file. The file is either named by `name', or
specified as a file object `fileobj' with a file descriptor. If
given, `arcname' specifies... | Create a TarInfo object from the result of os.stat or equivalent
on an existing file. The file is either named by `name', or
specified as a file object `fileobj' with a file descriptor. If
given, `arcname' specifies an alternative name for the file in the
archive, otherwise, ... | gettarinfo | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def addfile(self, tarinfo, fileobj=None):
"""Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects directly, or by using gettarinfo().
On Windows platforms, `fileobj' s... | Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects directly, or by using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to a... | addfile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tarfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tarfile.py | MIT |
def _read_until_with_poll(self, match, timeout):
"""Read until a given string is encountered or until timeout.
This method uses select.poll() to implement the timeout.
"""
n = len(match)
call_timeout = timeout
if timeout is not None:
from time import time
... | Read until a given string is encountered or until timeout.
This method uses select.poll() to implement the timeout.
| _read_until_with_poll | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _read_until_with_select(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = ... | Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
| _read_until_with_select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _expect_with_poll(self, expect_list, timeout=None):
"""Read until one from a list of a regular expressions matches.
This method uses select.poll() to implement the timeout.
"""
re = None
expect_list = expect_list[:]
indices = range(len(expect_list))
for i in ... | Read until one from a list of a regular expressions matches.
This method uses select.poll() to implement the timeout.
| _expect_with_poll | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def _expect_with_select(self, list, timeout=None):
"""Read until one from a list of a regular expressions matches.
The timeout is implemented using select.select().
"""
re = None
list = list[:]
indices = range(len(list))
for i in indices:
if not hasat... | Read until one from a list of a regular expressions matches.
The timeout is implemented using select.select().
| _expect_with_select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/telnetlib.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/telnetlib.py | MIT |
def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer s... | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is crea... | NamedTemporaryFile | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/tempfile.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/tempfile.py | MIT |
def acquire(self, blocking=1):
"""Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. O... | Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. Once
the lock is unlocked (not owne... | acquire | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def wait(self, timeout=None):
"""Wait until notified or until a timeout occurs.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method releases the underlying lock, and then blocks until it is
awakened by a notify() or ... | Wait until notified or until a timeout occurs.
If the calling thread has not acquired the lock when this method is
called, a RuntimeError is raised.
This method releases the underlying lock, and then blocks until it is
awakened by a notify() or notifyAll() call for the same condition
... | wait | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def acquire(self, blocking=1):
"""Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thre... | Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thread has called release() to
make it... | acquire | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def release(self):
"""Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
"""
with self.__cond:
self.__value = self.__value + 1
... | Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
| release | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def release(self):
"""Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
If the number of releases exceeds the number of acquires,
raise a V... | Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
If the number of releases exceeds the number of acquires,
raise a ValueError.
| release | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def set(self):
"""Set the internal flag to true.
All threads waiting for the flag to become true are awakened. Threads
that call wait() once the flag is true will not block at all.
"""
with self.__cond:
self.__flag = True
self.__cond.notify_all() | Set the internal flag to true.
All threads waiting for the flag to become true are awakened. Threads
that call wait() once the flag is true will not block at all.
| set | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def __init__(self, group=None, target=None, name=None,
args=(), kwargs=None, verbose=None):
"""This constructor should always be called with keyword arguments. Arguments are:
*group* should be None; reserved for future extension when a ThreadGroup
class is implemented.
... | This constructor should always be called with keyword arguments. Arguments are:
*group* should be None; reserved for future extension when a ThreadGroup
class is implemented.
*target* is the callable object to be invoked by the run()
method. Defaults to None, meaning nothing is called.... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def join(self, timeout=None):
"""Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is
called terminates -- either normally or through an unhandled exception
or until the optional timeout occurs.
When the timeout argument is pr... | Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is
called terminates -- either normally or through an unhandled exception
or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a
... | join | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def isAlive(self):
"""Return whether the thread is alive.
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
"""
assert self.__initialized, "Thre... | Return whether the thread is alive.
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
| isAlive | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/threading.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/threading.py | MIT |
def 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(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 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 lwp_cookie_str(cookie):
"""Return string representation of Cookie in the LWP cookie file format.
Actually, the format is extended a bit -- see module docstring.
"""
h = [(cookie.name, cookie.value),
("path", cookie.path),
("domain", cookie.domain)]
if cookie.port is not None:... | Return string representation of Cookie in the LWP cookie file format.
Actually, the format is extended a bit -- see module docstring.
| lwp_cookie_str | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_LWPCookieJar.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_LWPCookieJar.py | MIT |
def as_lwp_str(self, ignore_discard=True, ignore_expires=True):
"""Return cookies as a string of "\\n"-separated "Set-Cookie3" headers.
ignore_discard and ignore_expires: see docstring for FileCookieJar.save
"""
now = time.time()
r = []
for cookie in self:
i... | Return cookies as a string of "\n"-separated "Set-Cookie3" headers.
ignore_discard and ignore_expires: see docstring for FileCookieJar.save
| as_lwp_str | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_LWPCookieJar.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_LWPCookieJar.py | MIT |
def _read_output(commandstring):
"""Output from successful command execution or None"""
# Similar to os.popen(commandstring, "r").read(),
# but without actually using os.popen because that
# function is not usable during python bootstrap.
# tempfile is also not available then.
import contextlib
... | Output from successful command execution or None | _read_output | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _find_build_tool(toolname):
"""Find a build tool on current path or using xcrun"""
return (_find_executable(toolname)
or _read_output("/usr/bin/xcrun -find %s" % (toolname,))
or ''
) | Find a build tool on current path or using xcrun | _find_build_tool | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _get_system_version():
"""Return the OS X system version as a string"""
# Reading this plist is a documented way to get the system
# version (see the documentation for the Gestalt Manager)
# We avoid using platform.mac_ver to avoid possible bootstrap issues during
# the build of Python itself (d... | Return the OS X system version as a string | _get_system_version | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _remove_original_values(_config_vars):
"""Remove original unmodified values for testing"""
# This is needed for higher-level cross-platform tests of get_platform.
for k in list(_config_vars):
if k.startswith(_INITPRE):
del _config_vars[k] | Remove original unmodified values for testing | _remove_original_values | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _save_modified_value(_config_vars, cv, newvalue):
"""Save modified and original unmodified value of configuration var"""
oldvalue = _config_vars.get(cv, '')
if (oldvalue != newvalue) and (_INITPRE + cv not in _config_vars):
_config_vars[_INITPRE + cv] = oldvalue
_config_vars[cv] = newvalue | Save modified and original unmodified value of configuration var | _save_modified_value | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _supports_universal_builds():
"""Returns True if universal builds are supported on this system"""
# As an approximation, we assume that if we are running on 10.4 or above,
# then we are running with an Xcode environment that supports universal
# builds, in particular -isysroot and -arch arguments to... | Returns True if universal builds are supported on this system | _supports_universal_builds | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _find_appropriate_compiler(_config_vars):
"""Find appropriate C compiler for extension module builds"""
# Issue #13590:
# The OSX location for the compiler varies between OSX
# (or rather Xcode) releases. With older releases (up-to 10.5)
# the compiler is in /usr/bin, with newer relea... | Find appropriate C compiler for extension module builds | _find_appropriate_compiler | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _remove_universal_flags(_config_vars):
"""Remove all universal build arguments from config vars"""
for cv in _UNIVERSAL_CONFIG_VARS:
# Do not alter a config var explicitly overridden by env var
if cv in _config_vars and cv not in os.environ:
flags = _config_vars[cv]
... | Remove all universal build arguments from config vars | _remove_universal_flags | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _remove_unsupported_archs(_config_vars):
"""Remove any unsupported archs from config vars"""
# Different Xcode releases support different sets for '-arch'
# flags. In particular, Xcode 4.x no longer supports the
# PPC architectures.
#
# This code automatically removes '-arch ppc' and '-arch ... | Remove any unsupported archs from config vars | _remove_unsupported_archs | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _override_all_archs(_config_vars):
"""Allow override of all archs with ARCHFLAGS env var"""
# NOTE: This name was introduced by Apple in OSX 10.5 and
# is used by several scripting languages distributed with
# that OS release.
if 'ARCHFLAGS' in os.environ:
arch = os.environ['ARCHFLAGS']
... | Allow override of all archs with ARCHFLAGS env var | _override_all_archs | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _check_for_unavailable_sdk(_config_vars):
"""Remove references to any SDKs not available"""
# If we're on OSX 10.5 or later and the user tries to
# compile an extension using an SDK that is not present
# on the current machine it is better to not use an SDK
# than to fail. This is particularly ... | Remove references to any SDKs not available | _check_for_unavailable_sdk | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def customize_config_vars(_config_vars):
"""Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the e... | Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the environment
in which the interpreter is runni... | customize_config_vars | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def customize_compiler(_config_vars):
"""Customize compiler path and configuration variables.
This customization is performed when the first
extension module build is requested
in distutils.sysconfig.customize_compiler).
"""
# Find a compiler to use for extension module builds
_find_approp... | Customize compiler path and configuration variables.
This customization is performed when the first
extension module build is requested
in distutils.sysconfig.customize_compiler).
| customize_compiler | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_osx_support.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_osx_support.py | MIT |
def _checkClosed(self, msg=None):
"""Internal: raise a ValueError if file is closed
"""
if self.closed:
raise ValueError("I/O operation on closed file."
if msg is None else msg) | Internal: raise a ValueError if file is closed
| _checkClosed | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/_pyio.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/_pyio.py | MIT |
def contains_metastrings(s) :
"""Verify that the given string does not contain any
metadata strings that might interfere with dbtables database operation.
"""
if (s.find(_table_names_key) >= 0 or
s.find(_columns) >= 0 or
s.find(_data) >= 0 or
s.find(_rowid) >= 0):
# Then
... | Verify that the given string does not contain any
metadata strings that might interfere with dbtables database operation.
| contains_metastrings | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def _db_print(self) :
"""Print the database to stdout for debugging"""
print "******** Printing raw database for debugging ********"
cur = self.db.cursor()
try:
key, data = cur.first()
while 1:
print repr({key: data})
next = cur.nex... | Print the database to stdout for debugging | _db_print | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def CreateTable(self, table, columns):
"""CreateTable(table, columns) - Create a new table in the database.
raises TableDBError if it already exists or for other DB errors.
"""
assert isinstance(columns, list)
txn = None
try:
# checking sanity of the table a... | CreateTable(table, columns) - Create a new table in the database.
raises TableDBError if it already exists or for other DB errors.
| CreateTable | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def ListTableColumns(self, table):
"""Return a list of columns in the given table.
[] if the table doesn't exist.
"""
assert isinstance(table, str)
if contains_metastrings(table):
raise ValueError, "bad table name: contains reserved metastrings"
columnlist_ke... | Return a list of columns in the given table.
[] if the table doesn't exist.
| ListTableColumns | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def ListTables(self):
"""Return a list of tables in this database."""
pickledtablelist = self.db.get_get(_table_names_key)
if pickledtablelist:
return pickle.loads(pickledtablelist)
else:
return [] | Return a list of tables in this database. | ListTables | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def CreateOrExtendTable(self, table, columns):
"""CreateOrExtendTable(table, columns)
Create a new table in the database.
If a table of this name already exists, extend it to have any
additional columns present in the given list as well as
all of its current columns.
""... | CreateOrExtendTable(table, columns)
Create a new table in the database.
If a table of this name already exists, extend it to have any
additional columns present in the given list as well as
all of its current columns.
| CreateOrExtendTable | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def Insert(self, table, rowdict) :
"""Insert(table, datadict) - Insert a new row into the table
using the keys+values from rowdict as the column values.
"""
txn = None
try:
if not getattr(self.db, "has_key")(_columns_key(table)):
raise TableDBError, "... | Insert(table, datadict) - Insert a new row into the table
using the keys+values from rowdict as the column values.
| Insert | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def Modify(self, table, conditions={}, mappings={}):
"""Modify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'
* table - the table name
* conditions - a dictionary keyed on column names containing
a condition callab... | Modify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'
* table - the table name
* conditions - a dictionary keyed on column names containing
a condition callable expecting the data string as an
argument and return... | Modify | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def Delete(self, table, conditions={}):
"""Delete(table, conditions) - Delete items matching the given
conditions from the table.
* conditions - a dictionary keyed on column names containing
condition functions expecting the data string as an
argument and returning a boolean... | Delete(table, conditions) - Delete items matching the given
conditions from the table.
* conditions - a dictionary keyed on column names containing
condition functions expecting the data string as an
argument and returning a boolean.
| Delete | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def Select(self, table, columns, conditions={}):
"""Select(table, columns, conditions) - retrieve specific row data
Returns a list of row column->value mapping dictionaries.
* columns - a list of which column data to return. If
columns is None, all columns will be returned.
*... | Select(table, columns, conditions) - retrieve specific row data
Returns a list of row column->value mapping dictionaries.
* columns - a list of which column data to return. If
columns is None, all columns will be returned.
* conditions - a dictionary keyed on column names
c... | Select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def __Select(self, table, columns, conditions):
"""__Select() - Used to implement Select and Delete (above)
Returns a dictionary keyed on rowids containing dicts
holding the row data for columns listed in the columns param
that match the given conditions.
* conditions is a dictio... | __Select() - Used to implement Select and Delete (above)
Returns a dictionary keyed on rowids containing dicts
holding the row data for columns listed in the columns param
that match the given conditions.
* conditions is a dictionary keyed on column names
containing callable cond... | __Select | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def Drop(self, table):
"""Remove an entire table from the database"""
txn = None
try:
txn = self.env.txn_begin()
# delete the column list
self.db.delete(_columns_key(table), txn=txn)
cur = self.db.cursor(txn)
# delete all keys contai... | Remove an entire table from the database | Drop | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbtables.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbtables.py | MIT |
def DeadlockWrap(function, *_args, **_kwargs):
"""DeadlockWrap(function, *_args, **_kwargs) - automatically retries
function in case of a database deadlock.
This is a function intended to be used to wrap database calls such
that they perform retrys with exponentially backing off sleeps in
between w... | DeadlockWrap(function, *_args, **_kwargs) - automatically retries
function in case of a database deadlock.
This is a function intended to be used to wrap database calls such
that they perform retrys with exponentially backing off sleeps in
between when a DBLockDeadlockError exception is raised.
A ... | DeadlockWrap | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/bsddb/dbutils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/bsddb/dbutils.py | MIT |
def _get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
# This function was copied from Lib/distutils/msvccompiler.py
... | Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
| _get_build_version | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/util.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/util.py | MIT |
def find_msvcrt():
"""Return the name of the VC runtime dll"""
version = _get_build_version()
if version is None:
# better be safe than sorry
return None
if version <= 6:
clibname = 'msvcrt'
else:
clibname = 'msvcr%d' % (version * 1... | Return the name of the VC runtime dll | find_msvcrt | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/util.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/util.py | MIT |
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
arrays and structures are supported.
"""
# check _OTHER_ENDIAN attribute (present i... | Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
arrays and structures are supported.
| _other_endian | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/_endian.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/_endian.py | MIT |
def create_string_buffer(init, size=None):
"""create_string_buffer(aString) -> character array
create_string_buffer(anInteger) -> character array
create_string_buffer(aString, anInteger) -> character array
"""
if isinstance(init, (str, unicode)):
if size is None:
size = len(init)... | create_string_buffer(aString) -> character array
create_string_buffer(anInteger) -> character array
create_string_buffer(aString, anInteger) -> character array
| create_string_buffer | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/__init__.py | MIT |
def CFUNCTYPE(restype, *argtypes, **kw):
"""CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
ca... | CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
callable object:
prototype(integer address) -... | CFUNCTYPE | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/__init__.py | MIT |
def create_unicode_buffer(init, size=None):
"""create_unicode_buffer(aString) -> character array
create_unicode_buffer(anInteger) -> character array
create_unicode_buffer(aString, anInteger) -> character array
"""
if isinstance(init, (str, unicode)):
if size is None:
... | create_unicode_buffer(aString) -> character array
create_unicode_buffer(anInteger) -> character array
create_unicode_buffer(aString, anInteger) -> character array
| create_unicode_buffer | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/__init__.py | MIT |
def ensure_utf8(s):
"""Not all of PyObjC and Python understand unicode paths very well yet"""
if isinstance(s, unicode):
return s.encode('utf8')
return s | Not all of PyObjC and Python understand unicode paths very well yet | ensure_utf8 | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/ctypes/macholib/dyld.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/ctypes/macholib/dyld.py | MIT |
def rectangle(win, uly, ulx, lry, lrx):
"""Draw a rectangle with corners at the provided upper-left
and lower-right coordinates.
"""
win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1... | Draw a rectangle with corners at the provided upper-left
and lower-right coordinates.
| rectangle | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/curses/textpad.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/curses/textpad.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.