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 verify_metadata(self):
''' Send the metadata to the package index server to be checked.
'''
# send the info to the server and report the result
(code, result) = self.post_to_server(self.build_post_data('verify'))
log.info('Server response (%s): %s' % (code, result)) | Send the metadata to the package index server to be checked.
| verify_metadata | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/register.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/register.py | MIT |
def send_metadata(self):
''' Send the metadata to the package index server.
Well, do the following:
1. figure who the user is, and then
2. send the data as a Basic auth'ed POST.
First we try to read the username/password from $HOME/.pypirc,
which is ... | Send the metadata to the package index server.
Well, do the following:
1. figure who the user is, and then
2. send the data as a Basic auth'ed POST.
First we try to read the username/password from $HOME/.pypirc,
which is a ConfigParser-formatted file with a... | send_metadata | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/register.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/register.py | MIT |
def post_to_server(self, data, auth=None):
''' Post a query to the server, and return a string response.
'''
if 'name' in data:
self.announce('Registering %s to %s' % (data['name'],
self.repository),
... | Post a query to the server, and return a string response.
| post_to_server | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/register.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/register.py | MIT |
def show_formats():
"""Print all possible values for the 'formats' option (used by
the "--help-formats" command-line option).
"""
from distutils.fancy_getopt import FancyGetopt
from distutils.archive_util import ARCHIVE_FORMATS
formats = []
for format in ARCHIVE_FORMATS.keys():
forma... | Print all possible values for the 'formats' option (used by
the "--help-formats" command-line option).
| show_formats | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def get_file_list(self):
"""Figure out the list of files to include in the source
distribution, and put it in 'self.filelist'. This might involve
reading the manifest template (and writing the manifest), or just
reading the manifest, or just using the default file set -- it all
... | Figure out the list of files to include in the source
distribution, and put it in 'self.filelist'. This might involve
reading the manifest template (and writing the manifest), or just
reading the manifest, or just using the default file set -- it all
depends on the user's options.
... | get_file_list | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def add_defaults(self):
"""Add all the default files to self.filelist:
- README or README.txt
- setup.py
- test/test*.py
- all pure Python modules mentioned in setup script
- all files pointed by package_data (build_py)
- all files defined in data_file... | Add all the default files to self.filelist:
- README or README.txt
- setup.py
- test/test*.py
- all pure Python modules mentioned in setup script
- all files pointed by package_data (build_py)
- all files defined in data_files.
- all files defined as... | add_defaults | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def read_template(self):
"""Read and parse manifest template file named by self.template.
(usually "MANIFEST.in") The parsing and processing is done by
'self.filelist', which updates itself accordingly.
"""
log.info("reading manifest template '%s'", self.template)
templa... | Read and parse manifest template file named by self.template.
(usually "MANIFEST.in") The parsing and processing is done by
'self.filelist', which updates itself accordingly.
| read_template | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def prune_file_list(self):
"""Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
* the build tree (typically "build")
* the release tree itself (only an issue if we ran "sdist"
previously with --keep-temp,... | Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
* the build tree (typically "build")
* the release tree itself (only an issue if we ran "sdist"
previously with --keep-temp, or it aborted)
* any RCS, C... | prune_file_list | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def write_manifest(self):
"""Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'.
"""
if self._manifest_is_not_generated():
log.info("not writing to manually maintaine... | Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'.
| write_manifest | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def read_manifest(self):
"""Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution.
"""
log.info("reading manifest file '%s'", self.manifest)
manifest = open(self.manifest)
f... | Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution.
| read_manifest | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def make_release_tree(self, base_dir, files):
"""Create the directory tree that will become the source
distribution archive. All directories implied by the filenames in
'files' are created under 'base_dir', and then we hard link or copy
(if hard linking is unavailable) those files into ... | Create the directory tree that will become the source
distribution archive. All directories implied by the filenames in
'files' are created under 'base_dir', and then we hard link or copy
(if hard linking is unavailable) those files into place.
Essentially, this duplicates the developer... | make_release_tree | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def make_distribution(self):
"""Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
... | Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
'self.keep_temp' is true). The ... | make_distribution | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/distutils/command/sdist.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/distutils/command/sdist.py | MIT |
def base64_len(s):
"""Return the length of s when it is encoded with base64."""
groups_of_3, leftover = divmod(len(s), 3)
# 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
# Thanks, Tim!
n = groups_of_3 * 4
if leftover:
n += 4
return n | Return the length of s when it is encoded with base64. | base64_len | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/base64mime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/base64mime.py | MIT |
def header_encode(header, charset='iso-8859-1', keep_eols=False,
maxlinelen=76, eol=NL):
"""Encode a single header line with Base64 encoding in a given charset.
Defined in RFC 2045, this Base64 encoding is identical to normal Base64
encoding, except that each line must be intelligently wr... | Encode a single header line with Base64 encoding in a given charset.
Defined in RFC 2045, this Base64 encoding is identical to normal Base64
encoding, except that each line must be intelligently wrapped (respecting
the Base64 encoding), and subsequent lines must start with a space.
charset names the c... | header_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/base64mime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/base64mime.py | MIT |
def encode(s, binary=True, maxlinelen=76, eol=NL):
"""Encode a string with base64.
Each line will be wrapped at, at most, maxlinelen characters (defaults to
76 characters).
If binary is False, end-of-line characters will be converted to the
canonical email end-of-line sequence \\r\\n. Otherwise t... | Encode a string with base64.
Each line will be wrapped at, at most, maxlinelen characters (defaults to
76 characters).
If binary is False, end-of-line characters will be converted to the
canonical email end-of-line sequence \r\n. Otherwise they will be left
verbatim (this is the default).
Ea... | encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/base64mime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/base64mime.py | MIT |
def decode(s, convert_eols=None):
"""Decode a raw base64 string.
If convert_eols is set to a string value, all canonical email linefeeds,
e.g. "\\r\\n", in the decoded text will be converted to the value of
convert_eols. os.linesep is a good choice for convert_eols if you are
decoding a text attac... | Decode a raw base64 string.
If convert_eols is set to a string value, all canonical email linefeeds,
e.g. "\r\n", in the decoded text will be converted to the value of
convert_eols. os.linesep is a good choice for convert_eols if you are
decoding a text attachment.
This function does not parse a ... | decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/base64mime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/base64mime.py | MIT |
def add_charset(charset, header_enc=None, body_enc=None, output_charset=None):
"""Add character set properties to the global registry.
charset is the input character set, and must be the canonical name of a
character set.
Optional header_enc and body_enc is either Charset.QP for
quoted-printable, ... | Add character set properties to the global registry.
charset is the input character set, and must be the canonical name of a
character set.
Optional header_enc and body_enc is either Charset.QP for
quoted-printable, Charset.BASE64 for base64 encoding, Charset.SHORTEST for
the shortest of qp or bas... | add_charset | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def get_body_encoding(self):
"""Return the content-transfer-encoding used for body encoding.
This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object... | Return the content-transfer-encoding used for body encoding.
This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object being
encoded. The function sh... | get_body_encoding | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def convert(self, s):
"""Convert a string from the input_codec to the output_codec."""
if self.input_codec != self.output_codec:
return unicode(s, self.input_codec).encode(self.output_codec)
else:
return s | Convert a string from the input_codec to the output_codec. | convert | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def to_splittable(self, s):
"""Convert a possibly multibyte string to a safely splittable format.
Uses the input_codec to try and convert the string to Unicode, so it
can be safely split on character boundaries (even for multibyte
characters).
Returns the string as-is if it isn... | Convert a possibly multibyte string to a safely splittable format.
Uses the input_codec to try and convert the string to Unicode, so it
can be safely split on character boundaries (even for multibyte
characters).
Returns the string as-is if it isn't known how to convert it to
U... | to_splittable | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def from_splittable(self, ustr, to_output=True):
"""Convert a splittable string back into an encoded string.
Uses the proper codec to try and convert the string from Unicode back
into an encoded format. Return the string as-is if it is not Unicode,
or if it could not be converted from ... | Convert a splittable string back into an encoded string.
Uses the proper codec to try and convert the string from Unicode back
into an encoded format. Return the string as-is if it is not Unicode,
or if it could not be converted from Unicode.
Characters that could not be converted fro... | from_splittable | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def encoded_header_len(self, s):
"""Return the length of the encoded header string."""
cset = self.get_output_charset()
# The len(s) of a 7bit encoding is len(s)
if self.header_encoding == BASE64:
return email.base64mime.base64_len(s) + len(cset) + MISC_LEN
elif self.... | Return the length of the encoded header string. | encoded_header_len | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def header_encode(self, s, convert=False):
"""Header-encode a string, optionally converting it to output_charset.
If convert is True, the string will be converted from the input
charset to the output charset automatically. This is not useful for
multibyte character sets, which have lin... | Header-encode a string, optionally converting it to output_charset.
If convert is True, the string will be converted from the input
charset to the output charset automatically. This is not useful for
multibyte character sets, which have line length issues (multibyte
characters must be ... | header_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def body_encode(self, s, convert=True):
"""Body-encode a string and convert it to output_charset.
If convert is True (the default), the string will be converted from
the input charset to output charset automatically. Unlike
header_encode(), there are no issues with byte boundaries and
... | Body-encode a string and convert it to output_charset.
If convert is True (the default), the string will be converted from
the input charset to output charset automatically. Unlike
header_encode(), there are no issues with byte boundaries and
multibyte charsets in email bodies, so this... | body_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/charset.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/charset.py | MIT |
def encode_base64(msg):
"""Encode the message's payload in Base64.
Also, add an appropriate Content-Transfer-Encoding header.
"""
orig = msg.get_payload()
encdata = _bencode(orig)
msg.set_payload(encdata)
msg['Content-Transfer-Encoding'] = 'base64' | Encode the message's payload in Base64.
Also, add an appropriate Content-Transfer-Encoding header.
| encode_base64 | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/encoders.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/encoders.py | MIT |
def encode_quopri(msg):
"""Encode the message's payload in quoted-printable.
Also, add an appropriate Content-Transfer-Encoding header.
"""
orig = msg.get_payload()
encdata = _qencode(orig)
msg.set_payload(encdata)
msg['Content-Transfer-Encoding'] = 'quoted-printable' | Encode the message's payload in quoted-printable.
Also, add an appropriate Content-Transfer-Encoding header.
| encode_quopri | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/encoders.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/encoders.py | MIT |
def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload()
if orig is None:
# There's no payload. For backwards compatibility we use 7bit
msg['Content-Transfer-Encoding'] = '7bit'
return
# We play a trick to make this go fas... | Set the Content-Transfer-Encoding header to 7bit or 8bit. | encode_7or8bit | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/encoders.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/encoders.py | MIT |
def push(self, data):
"""Push some new data into this object."""
# Crack into lines, but preserve the linesep characters on the end of each
parts = data.splitlines(True)
if not parts or not parts[0].endswith(('\n', '\r')):
# No new complete lines, so just accumulate partials... | Push some new data into this object. | push | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/feedparser.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/feedparser.py | MIT |
def __init__(self, _factory=message.Message):
"""_factory is called with no arguments to create a new message obj"""
self._factory = _factory
self._input = BufferedSubFile()
self._msgstack = []
self._parse = self._parsegen().next
self._cur = None
self._last = None... | _factory is called with no arguments to create a new message obj | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/feedparser.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/feedparser.py | MIT |
def close(self):
"""Parse all remaining data and return the root message object."""
self._input.close()
self._call_parse()
root = self._pop_message()
assert not self._msgstack
# Look for final set of defects
if root.get_content_maintype() == 'multipart' \
... | Parse all remaining data and return the root message object. | close | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/feedparser.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/feedparser.py | MIT |
def __init__(self, outfp, mangle_from_=True, maxheaderlen=78):
"""Create the generator for message flattening.
outfp is the output file-like object for writing the message to. It
must have a write() method.
Optional mangle_from_ is a flag that, when True (the default), escapes
... | Create the generator for message flattening.
outfp is the output file-like object for writing the message to. It
must have a write() method.
Optional mangle_from_ is a flag that, when True (the default), escapes
From_ lines in the body of the message by putting a `>' in front of
... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/generator.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/generator.py | MIT |
def decode_header(header):
"""Decode a message header value without converting charset.
Returns a list of (decoded_string, charset) pairs containing each of the
decoded parts of the header. Charset is None for non-encoded parts of the
header, otherwise a lower-case string containing the name of the ch... | Decode a message header value without converting charset.
Returns a list of (decoded_string, charset) pairs containing each of the
decoded parts of the header. Charset is None for non-encoded parts of the
header, otherwise a lower-case string containing the name of the character
set specified in the e... | decode_header | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/header.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/header.py | MIT |
def make_header(decoded_seq, maxlinelen=None, header_name=None,
continuation_ws=' '):
"""Create a Header from a sequence of pairs as returned by decode_header()
decode_header() takes a header value string and returns a sequence of
pairs of the format (decoded_string, charset) where charset ... | Create a Header from a sequence of pairs as returned by decode_header()
decode_header() takes a header value string and returns a sequence of
pairs of the format (decoded_string, charset) where charset is the string
name of the character set.
This function takes one of those sequence of pairs and retu... | make_header | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/header.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/header.py | MIT |
def __unicode__(self):
"""Helper for the built-in unicode function."""
uchunks = []
lastcs = None
for s, charset in self._chunks:
# We must preserve spaces between encoded and non-encoded word
# boundaries, which means for us we need to add a space when we go
... | Helper for the built-in unicode function. | __unicode__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/header.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/header.py | MIT |
def append(self, s, charset=None, errors='strict'):
"""Append a string to the MIME header.
Optional charset, if given, should be a Charset instance or the name
of a character set (which will be converted to a Charset instance). A
value of None (the default) means that the charset given... | Append a string to the MIME header.
Optional charset, if given, should be a Charset instance or the name
of a character set (which will be converted to a Charset instance). A
value of None (the default) means that the charset given in the
constructor is used.
s may be a byte s... | append | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/header.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/header.py | MIT |
def walk(self):
"""Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator.
"""
yield self
if self.is_multipart():
for subpart in self.get_payload():
for subsubpart in subpart.walk():
yield su... | Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator.
| walk | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/iterators.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/iterators.py | MIT |
def body_line_iterator(msg, decode=False):
"""Iterate over the parts, returning string payloads line-by-line.
Optional decode (default False) is passed through to .get_payload().
"""
for subpart in msg.walk():
payload = subpart.get_payload(decode=decode)
if isinstance(payload, basestrin... | Iterate over the parts, returning string payloads line-by-line.
Optional decode (default False) is passed through to .get_payload().
| body_line_iterator | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/iterators.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/iterators.py | MIT |
def _formatparam(param, value=None, quote=True):
"""Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true. If value is a
three tuple (charset, language, value), it will be encoded according
to RFC2231 rules.
"""
if value is not None... | Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true. If value is a
three tuple (charset, language, value), it will be encoded according
to RFC2231 rules.
| _formatparam | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def as_string(self, unixfrom=False):
"""Return the entire formatted message as a string.
Optional `unixfrom' when True, means include the Unix From_ envelope
header.
This is a convenience method and may not generate the message exactly
as you intend because by default it mangles... | Return the entire formatted message as a string.
Optional `unixfrom' when True, means include the Unix From_ envelope
header.
This is a convenience method and may not generate the message exactly
as you intend because by default it mangles lines that begin with
"From ". For mor... | as_string | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def attach(self, payload):
"""Add the given payload to the current payload.
The current payload will always be a list of objects after this method
is called. If you want to set the payload to a scalar object, use
set_payload() instead.
"""
if self._payload is None:
... | Add the given payload to the current payload.
The current payload will always be a list of objects after this method
is called. If you want to set the payload to a scalar object, use
set_payload() instead.
| attach | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_payload(self, i=None, decode=False):
"""Return a reference to the payload.
The payload will either be a list object or a string. If you mutate
the list object, you modify the message's payload in place. Optional
i returns that index into the payload.
Optional decode i... | Return a reference to the payload.
The payload will either be a list object or a string. If you mutate
the list object, you modify the message's payload in place. Optional
i returns that index into the payload.
Optional decode is a flag indicating whether the payload should be
... | get_payload | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def set_payload(self, payload, charset=None):
"""Set the payload to the given value.
Optional charset sets the message's default character set. See
set_charset() for details.
"""
self._payload = payload
if charset is not None:
self.set_charset(charset) | Set the payload to the given value.
Optional charset sets the message's default character set. See
set_charset() for details.
| set_payload | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def set_charset(self, charset):
"""Set the charset of the payload to a given character set.
charset can be a Charset instance, a string naming a character set, or
None. If it is a string it will be converted to a Charset instance.
If charset is None, the charset parameter will be remov... | Set the charset of the payload to a given character set.
charset can be a Charset instance, a string naming a character set, or
None. If it is a string it will be converted to a Charset instance.
If charset is None, the charset parameter will be removed from the
Content-Type field. An... | set_charset | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def __delitem__(self, name):
"""Delete all occurrences of a header, if present.
Does not raise an exception if the header is missing.
"""
name = name.lower()
newheaders = []
for k, v in self._headers:
if k.lower() != name:
newheaders.append((k... | Delete all occurrences of a header, if present.
Does not raise an exception if the header is missing.
| __delitem__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def has_key(self, name):
"""Return true if the message contains the header."""
missing = object()
return self.get(name, missing) is not missing | Return true if the message contains the header. | has_key | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get(self, name, failobj=None):
"""Get a header value.
Like __getitem__() but return failobj instead of None when the field
is missing.
"""
name = name.lower()
for k, v in self._headers:
if k.lower() == name:
return v
return failobj | Get a header value.
Like __getitem__() but return failobj instead of None when the field
is missing.
| get | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_all(self, name, failobj=None):
"""Return a list of all the values for the named field.
These will be sorted in the order they appeared in the original
message, and may contain duplicates. Any fields deleted and
re-inserted are always appended to the header list.
If no ... | Return a list of all the values for the named field.
These will be sorted in the order they appeared in the original
message, and may contain duplicates. Any fields deleted and
re-inserted are always appended to the header list.
If no such fields exist, failobj is returned (defaults t... | get_all | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def add_header(self, _name, _value, **_params):
"""Extended header setting.
name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unles... | Extended header setting.
name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unless
value is None, in which case only the key will be... | add_header | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def replace_header(self, _name, _value):
"""Replace a header.
Replace the first matching header found in the message, retaining
header order and case. If no matching header was found, a KeyError is
raised.
"""
_name = _name.lower()
for i, (k, v) in zip(range(len... | Replace a header.
Replace the first matching header found in the message, retaining
header order and case. If no matching header was found, a KeyError is
raised.
| replace_header | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_content_type(self):
"""Return the message's content type.
The returned string is coerced to lower case of the form
`maintype/subtype'. If there was no Content-Type header in the
message, the default type as given by get_default_type() will be
returned. Since according ... | Return the message's content type.
The returned string is coerced to lower case of the form
`maintype/subtype'. If there was no Content-Type header in the
message, the default type as given by get_default_type() will be
returned. Since according to RFC 2045, messages always have a def... | get_content_type | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_params(self, failobj=None, header='content-type', unquote=True):
"""Return the message's Content-Type parameters, as a list.
The elements of the returned list are 2-tuples of key/value pairs, as
split on the `=' sign. The left hand side of the `=' is the key,
while the right ha... | Return the message's Content-Type parameters, as a list.
The elements of the returned list are 2-tuples of key/value pairs, as
split on the `=' sign. The left hand side of the `=' is the key,
while the right hand side is the value. If there is no `=' sign in
the parameter the value is... | get_params | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_param(self, param, failobj=None, header='content-type',
unquote=True):
"""Return the parameter value if found in the Content-Type header.
Optional failobj is the object to return if there is no Content-Type
header, or the Content-Type header has no such parameter. Opt... | Return the parameter value if found in the Content-Type header.
Optional failobj is the object to return if there is no Content-Type
header, or the Content-Type header has no such parameter. Optional
header is the header to search instead of Content-Type.
Parameter keys are always com... | get_param | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def set_param(self, param, value, header='Content-Type', requote=True,
charset=None, language=''):
"""Set a parameter in the Content-Type header.
If the parameter already exists in the header, its value will be
replaced with the new value.
If header is Content-Type an... | Set a parameter in the Content-Type header.
If the parameter already exists in the header, its value will be
replaced with the new value.
If header is Content-Type and has not yet been defined for this
message, it will be set to "text/plain" and the new parameter and
value will... | set_param | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def del_param(self, param, header='content-type', requote=True):
"""Remove the given parameter completely from the Content-Type header.
The header will be re-written in place without the parameter or its
value. All values will be quoted as necessary unless requote is
False. Optional he... | Remove the given parameter completely from the Content-Type header.
The header will be re-written in place without the parameter or its
value. All values will be quoted as necessary unless requote is
False. Optional header specifies an alternative to the Content-Type
header.
| del_param | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def set_type(self, type, header='Content-Type', requote=True):
"""Set the main type and subtype for the Content-Type header.
type must be a string in the form "maintype/subtype", otherwise a
ValueError is raised.
This method replaces the Content-Type header, keeping all the
par... | Set the main type and subtype for the Content-Type header.
type must be a string in the form "maintype/subtype", otherwise a
ValueError is raised.
This method replaces the Content-Type header, keeping all the
parameters in place. If requote is False, this leaves the existing
h... | set_type | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_filename(self, failobj=None):
"""Return the filename associated with the payload if present.
The filename is extracted from the Content-Disposition header's
`filename' parameter, and it is unquoted. If that header is missing
the `filename' parameter, this method falls back to l... | Return the filename associated with the payload if present.
The filename is extracted from the Content-Disposition header's
`filename' parameter, and it is unquoted. If that header is missing
the `filename' parameter, this method falls back to looking for the
`name' parameter.
| get_filename | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_boundary(self, failobj=None):
"""Return the boundary associated with the payload if present.
The boundary is extracted from the Content-Type header's `boundary'
parameter, and it is unquoted.
"""
missing = object()
boundary = self.get_param('boundary', missing)
... | Return the boundary associated with the payload if present.
The boundary is extracted from the Content-Type header's `boundary'
parameter, and it is unquoted.
| get_boundary | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def set_boundary(self, boundary):
"""Set the boundary parameter in Content-Type to 'boundary'.
This is subtly different than deleting the Content-Type header and
adding a new one with a new boundary parameter via add_header(). The
main difference is that using the set_boundary() method... | Set the boundary parameter in Content-Type to 'boundary'.
This is subtly different than deleting the Content-Type header and
adding a new one with a new boundary parameter via add_header(). The
main difference is that using the set_boundary() method preserves the
order of the Content-T... | set_boundary | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def get_content_charset(self, failobj=None):
"""Return the charset parameter of the Content-Type header.
The returned string is always coerced to lower case. If there is no
Content-Type header, or if that header has no charset parameter,
failobj is returned.
"""
missing... | Return the charset parameter of the Content-Type header.
The returned string is always coerced to lower case. If there is no
Content-Type header, or if that header has no charset parameter,
failobj is returned.
| get_content_charset | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/message.py | MIT |
def __init__(self, *args, **kws):
"""Parser of RFC 2822 and MIME email messages.
Creates an in-memory object tree representing the email message, which
can then be manipulated and turned over to a Generator to return the
textual representation of the message.
The string must be... | Parser of RFC 2822 and MIME email messages.
Creates an in-memory object tree representing the email message, which
can then be manipulated and turned over to a Generator to return the
textual representation of the message.
The string must be formatted as a block of RFC 2822 headers and... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/parser.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/parser.py | MIT |
def parse(self, fp, headersonly=False):
"""Create a message structure from the data in a file.
Reads all the data from the file and returns the root of the message
structure. Optional headersonly is a flag specifying whether to stop
parsing after reading the headers or not. The defaul... | Create a message structure from the data in a file.
Reads all the data from the file and returns the root of the message
structure. Optional headersonly is a flag specifying whether to stop
parsing after reading the headers or not. The default is False,
meaning it parses the entire co... | parse | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/parser.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/parser.py | MIT |
def header_quopri_len(s):
"""Return the length of str when it is encoded with header quopri."""
count = 0
for c in s:
if hqre.match(c):
count += 3
else:
count += 1
return count | Return the length of str when it is encoded with header quopri. | header_quopri_len | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def body_quopri_len(str):
"""Return the length of str when it is encoded with body quopri."""
count = 0
for c in str:
if bqre.match(c):
count += 3
else:
count += 1
return count | Return the length of str when it is encoded with body quopri. | body_quopri_len | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def header_encode(header, charset="iso-8859-1", keep_eols=False,
maxlinelen=76, eol=NL):
"""Encode a single header line with quoted-printable (like) encoding.
Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
used specifically for email header fields to allow char... | Encode a single header line with quoted-printable (like) encoding.
Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
used specifically for email header fields to allow charsets with mostly 7
bit characters (and some 8 bit) to remain more or less readable in non-RFC
2045 aware m... | header_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def encode(body, binary=False, maxlinelen=76, eol=NL):
"""Encode with quoted-printable, wrapping at maxlinelen characters.
If binary is False (the default), end-of-line characters will be converted
to the canonical email end-of-line sequence \\r\\n. Otherwise they will
be left verbatim.
Each line... | Encode with quoted-printable, wrapping at maxlinelen characters.
If binary is False (the default), end-of-line characters will be converted
to the canonical email end-of-line sequence \r\n. Otherwise they will
be left verbatim.
Each line of encoded text will end with eol, which defaults to "\n". Set... | encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def decode(encoded, eol=NL):
"""Decode a quoted-printable string.
Lines are separated with eol, which defaults to \\n.
"""
if not encoded:
return encoded
# BAW: see comment in encode() above. Again, we're building up the
# decoded string with string concatenation, which could be done m... | Decode a quoted-printable string.
Lines are separated with eol, which defaults to \n.
| decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def header_decode(s):
"""Decode a string encoded with RFC 2045 MIME header `Q' encoding.
This function does not parse a full MIME header value encoded with
quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
the high level email.header class for that functionality.
"""
s = s.repl... | Decode a string encoded with RFC 2045 MIME header `Q' encoding.
This function does not parse a full MIME header value encoded with
quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
the high level email.header class for that functionality.
| header_decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/quoprimime.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/quoprimime.py | MIT |
def _bdecode(s):
"""Decodes a base64 string.
This function is equivalent to base64.decodestring and it's retained only
for backward compatibility. It used to remove the last \\n of the decoded
string, if it had any (see issue 7143).
"""
if not s:
return s
return base64.decodestring(... | Decodes a base64 string.
This function is equivalent to base64.decodestring and it's retained only
for backward compatibility. It used to remove the last \n of the decoded
string, if it had any (see issue 7143).
| _bdecode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def fix_eols(s):
"""Replace all line-ending characters with \\r\\n."""
# Fix newlines with no preceding carriage return
s = re.sub(r'(?<!\r)\n', CRLF, s)
# Fix carriage returns with no following newline
s = re.sub(r'\r(?!\n)', CRLF, s)
return s | Replace all line-ending characters with \r\n. | fix_eols | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def formataddr(pair):
"""The inverse of parseaddr(), this takes a 2-tuple of the form
(realname, email_address) and returns the string value suitable
for an RFC 2822 From, To or Cc header.
If the first element of pair is false, then the second element is
returned unmodified.
"""
name, addre... | The inverse of parseaddr(), this takes a 2-tuple of the form
(realname, email_address) and returns the string value suitable
for an RFC 2822 From, To or Cc header.
If the first element of pair is false, then the second element is
returned unmodified.
| formataddr | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def getaddresses(fieldvalues):
"""Return a list of (REALNAME, EMAIL) for each fieldvalue."""
all = COMMASPACE.join(fieldvalues)
a = _AddressList(all)
return a.addresslist | Return a list of (REALNAME, EMAIL) for each fieldvalue. | getaddresses | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def formatdate(timeval=None, localtime=False, usegmt=False):
"""Returns a date string as specified by RFC 2822, e.g.:
Fri, 09 Nov 2001 01:08:47 -0000
Optional timeval if given is a floating point time value as accepted by
gmtime() and localtime(), otherwise the current time is used.
Optional loca... | Returns a date string as specified by RFC 2822, e.g.:
Fri, 09 Nov 2001 01:08:47 -0000
Optional timeval if given is a floating point time value as accepted by
gmtime() and localtime(), otherwise the current time is used.
Optional localtime is a flag that when True, interprets timeval, and
returns ... | formatdate | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def make_msgid(idstring=None):
"""Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
<142480216486.20800.16526388040877946887@nightshade.la.mastaler.com>
Optional idstring if given is a string used to strengthen the
uniqueness of the message id.
"""
timeval = int(time.time()*100... | Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
<142480216486.20800.16526388040877946887@nightshade.la.mastaler.com>
Optional idstring if given is a string used to strengthen the
uniqueness of the message id.
| make_msgid | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def encode_rfc2231(s, charset=None, language=None):
"""Encode string according to RFC 2231.
If neither charset nor language is given, then s is returned as-is. If
charset is given but not language, the string is encoded using the empty
string for language.
"""
import urllib
s = urllib.quot... | Encode string according to RFC 2231.
If neither charset nor language is given, then s is returned as-is. If
charset is given but not language, the string is encoded using the empty
string for language.
| encode_rfc2231 | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def decode_params(params):
"""Decode parameters list according to RFC 2231.
params is a sequence of 2-tuples containing (param name, string value).
"""
# Copy params so we don't mess with the original
params = params[:]
new_params = []
# Map parameter's name to a list of continuations. The... | Decode parameters list according to RFC 2231.
params is a sequence of 2-tuples containing (param name, string value).
| decode_params | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/utils.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/utils.py | MIT |
def parsedate_tz(data):
"""Convert a date string to a time tuple.
Accounts for military timezones.
"""
data = data.split()
# The FWS after the comma after the day-of-week is optional, so search and
# adjust for this.
if data[0].endswith(',') or data[0].lower() in _daynames:
# There'... | Convert a date string to a time tuple.
Accounts for military timezones.
| parsedate_tz | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def parsedate(data):
"""Convert a time string to a time tuple."""
t = parsedate_tz(data)
if isinstance(t, tuple):
return t[:9]
else:
return t | Convert a time string to a time tuple. | parsedate | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def mktime_tz(data):
"""Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp."""
if data[9] is None:
# No zone info, so localtime is better assumption than GMT
return time.mktime(data[:8] + (-1,))
else:
t = calendar.timegm(data)
return t - data[9] | Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp. | mktime_tz | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def __init__(self, field):
"""Initialize a new instance.
`field' is an unparsed address header field, containing
one or more addresses.
"""
self.specials = '()<>@,:;.\"[]'
self.pos = 0
self.LWS = ' \t'
self.CR = '\r\n'
self.FWS = self.LWS + self.C... | Initialize a new instance.
`field' is an unparsed address header field, containing
one or more addresses.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def gotonext(self):
"""Parse up to the start of the next address."""
while self.pos < len(self.field):
if self.field[self.pos] in self.LWS + '\n\r':
self.pos += 1
elif self.field[self.pos] == '(':
self.commentlist.append(self.getcomment())
... | Parse up to the start of the next address. | gotonext | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def getaddrlist(self):
"""Parse all addresses.
Returns a list containing all of the addresses.
"""
result = []
while self.pos < len(self.field):
ad = self.getaddress()
if ad:
result += ad
else:
result.append((''... | Parse all addresses.
Returns a list containing all of the addresses.
| getaddrlist | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def getrouteaddr(self):
"""Parse a route address (Return-path value).
This method just skips all the route stuff and returns the addrspec.
"""
if self.field[self.pos] != '<':
return
expectroute = False
self.pos += 1
self.gotonext()
adlist = '... | Parse a route address (Return-path value).
This method just skips all the route stuff and returns the addrspec.
| getrouteaddr | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def getdomain(self):
"""Get the complete domain name from an address."""
sdlist = []
while self.pos < len(self.field):
if self.field[self.pos] in self.LWS:
self.pos += 1
elif self.field[self.pos] == '(':
self.commentlist.append(self.getcomm... | Get the complete domain name from an address. | getdomain | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def getphraselist(self):
"""Parse a sequence of RFC 2822 phrases.
A phrase is a sequence of words, which are in turn either RFC 2822
atoms or quoted-strings. Phrases are canonicalized by squeezing all
runs of continuous whitespace into one space.
"""
plist = []
... | Parse a sequence of RFC 2822 phrases.
A phrase is a sequence of words, which are in turn either RFC 2822
atoms or quoted-strings. Phrases are canonicalized by squeezing all
runs of continuous whitespace into one space.
| getphraselist | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/_parseaddr.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/_parseaddr.py | MIT |
def message_from_string(s, *args, **kws):
"""Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from email.parser import Parser
return Parser(*args, **kws).parsestr(s) | Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
| message_from_string | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/__init__.py | MIT |
def message_from_file(fp, *args, **kws):
"""Read a file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from email.parser import Parser
return Parser(*args, **kws).parse(fp) | Read a file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
| message_from_file | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/__init__.py | MIT |
def __init__(self, _data, _subtype='octet-stream',
_encoder=encoders.encode_base64, **_params):
"""Create an application/* type MIME document.
_data is a string containing the raw application data.
_subtype is the MIME content type subtype, defaulting to
'octet-stream'... | Create an application/* type MIME document.
_data is a string containing the raw application data.
_subtype is the MIME content type subtype, defaulting to
'octet-stream'.
_encoder is a function which will perform the actual encoding for
transport of the application data, defa... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/application.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/application.py | MIT |
def _whatsnd(data):
"""Try to identify a sound file type.
sndhdr.what() has a pretty cruddy interface, unfortunately. This is why
we re-do it here. It would be easier to reverse engineer the Unix 'file'
command and use the standard 'magic' file, as shipped with a modern Unix.
"""
hdr = data[:... | Try to identify a sound file type.
sndhdr.what() has a pretty cruddy interface, unfortunately. This is why
we re-do it here. It would be easier to reverse engineer the Unix 'file'
command and use the standard 'magic' file, as shipped with a modern Unix.
| _whatsnd | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/audio.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/audio.py | MIT |
def __init__(self, _audiodata, _subtype=None,
_encoder=encoders.encode_base64, **_params):
"""Create an audio/* type MIME document.
_audiodata is a string containing the raw audio data. If this data
can be decoded by the standard Python `sndhdr' module, then the
subtyp... | Create an audio/* type MIME document.
_audiodata is a string containing the raw audio data. If this data
can be decoded by the standard Python `sndhdr' module, then the
subtype will be automatically included in the Content-Type header.
Otherwise, you can specify the specific audio sub... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/audio.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/audio.py | MIT |
def __init__(self, _maintype, _subtype, **_params):
"""This constructor adds a Content-Type: and a MIME-Version: header.
The Content-Type: header is taken from the _maintype and _subtype
arguments. Additional parameters for this header are taken from the
keyword arguments.
"""
... | This constructor adds a Content-Type: and a MIME-Version: header.
The Content-Type: header is taken from the _maintype and _subtype
arguments. Additional parameters for this header are taken from the
keyword arguments.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/base.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/base.py | MIT |
def __init__(self, _imagedata, _subtype=None,
_encoder=encoders.encode_base64, **_params):
"""Create an image/* type MIME document.
_imagedata is a string containing the raw image data. If this data
can be decoded by the standard Python `imghdr' module, then the
subtyp... | Create an image/* type MIME document.
_imagedata is a string containing the raw image data. If this data
can be decoded by the standard Python `imghdr' module, then the
subtype will be automatically included in the Content-Type header.
Otherwise, you can specify the specific image subt... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/image.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/image.py | MIT |
def __init__(self, _msg, _subtype='rfc822'):
"""Create a message/* type MIME document.
_msg is a message object and must be an instance of Message, or a
derived class of Message, otherwise a TypeError is raised.
Optional _subtype defines the subtype of the contained message. The
... | Create a message/* type MIME document.
_msg is a message object and must be an instance of Message, or a
derived class of Message, otherwise a TypeError is raised.
Optional _subtype defines the subtype of the contained message. The
default is "rfc822" (this is defined by the MIME stan... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/message.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/message.py | MIT |
def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
**_params):
"""Creates a multipart/* type message.
By default, creates a multipart/mixed message, with proper
Content-Type and MIME-Version headers.
_subtype is the subtype of the multipart content typ... | Creates a multipart/* type message.
By default, creates a multipart/mixed message, with proper
Content-Type and MIME-Version headers.
_subtype is the subtype of the multipart content type, defaulting to
`mixed'.
boundary is the multipart boundary string. By default it is
... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/multipart.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/multipart.py | MIT |
def __init__(self, _text, _subtype='plain', _charset='us-ascii'):
"""Create a text/* type MIME document.
_text is the string for this message object.
_subtype is the MIME sub content type, defaulting to "plain".
_charset is the character set parameter added to the Content-Type
... | Create a text/* type MIME document.
_text is the string for this message object.
_subtype is the MIME sub content type, defaulting to "plain".
_charset is the character set parameter added to the Content-Type
header. This defaults to "us-ascii". Note that as a side-effect, the
... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/email/mime/text.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/email/mime/text.py | MIT |
def base64_encode(input,errors='strict'):
""" Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
"""
... | Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
| base64_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/base64_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/base64_codec.py | MIT |
def base64_decode(input,errors='strict'):
""" Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providin... | Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing this slot.
errors defines the error han... | base64_decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/base64_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/base64_codec.py | MIT |
def bz2_encode(input,errors='strict'):
""" Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
"""
a... | Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
| bz2_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/bz2_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/bz2_codec.py | MIT |
def bz2_decode(input,errors='strict'):
""" Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing t... | Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing this slot.
errors defines the error han... | bz2_decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/bz2_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/bz2_codec.py | MIT |
def hex_encode(input,errors='strict'):
""" Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
"""
a... | Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
| hex_encode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/hex_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/hex_codec.py | MIT |
def hex_decode(input,errors='strict'):
""" Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing t... | Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing this slot.
errors defines the error han... | hex_decode | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/encodings/hex_codec.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/encodings/hex_codec.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.