Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Trim trailing whitespace
  • Loading branch information
hugovk committed Aug 21, 2023
commit cd547a2fd51455f9816bfba8e6912a2a4ca8155f
2 changes: 1 addition & 1 deletion Lib/email/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
]



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Some convenience routines. Don't import Parser and Message as side-effects
# of importing email since those cascadingly import most of the rest of the
# email package.
Expand Down
8 changes: 4 additions & 4 deletions Lib/email/base64mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
MISC_LEN = 7



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Helpers
def header_length(bytearray):
"""Return the length of s when it is encoded with base64."""
Expand All @@ -57,7 +57,7 @@ def header_length(bytearray):
return n



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def header_encode(header_bytes, charset='iso-8859-1'):
"""Encode a single header line with Base64 encoding in a given charset.

Expand All @@ -72,7 +72,7 @@ def header_encode(header_bytes, charset='iso-8859-1'):
return '=?%s?b?%s?=' % (charset, encoded)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def body_encode(s, maxlinelen=76, eol=NL):
r"""Encode a string with base64.

Expand All @@ -98,7 +98,7 @@ def body_encode(s, maxlinelen=76, eol=NL):
return EMPTYSTRING.join(encvec)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def decode(string):
"""Decode a raw base64 string, returning a bytes object.

Expand Down
10 changes: 5 additions & 5 deletions Lib/email/charset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from email.encoders import encode_7or8bit



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Flags for types of header encodings
QP = 1 # Quoted-Printable
BASE64 = 2 # Base64
Expand All @@ -32,7 +32,7 @@
EMPTYSTRING = ''



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Defaults
CHARSETS = {
# input header enc body enc output conv
Expand Down Expand Up @@ -104,7 +104,7 @@
}



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Convenience functions for extending the above mappings
def add_charset(charset, header_enc=None, body_enc=None, output_charset=None):
"""Add character set properties to the global registry.
Expand Down Expand Up @@ -153,7 +153,7 @@ def add_codec(charset, codecname):
CODEC_MAP[charset] = codecname



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Convenience function for encoding strings, taking into account
# that they might be unknown-8bit (ie: have surrogate-escaped bytes)
def _encode(string, codec):
Expand All @@ -163,7 +163,7 @@ def _encode(string, codec):
return string.encode(codec)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class Charset:
"""Map character sets to their email properties.

Expand Down
8 changes: 4 additions & 4 deletions Lib/email/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from quopri import encodestring as _encodestring



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def _qencode(s):
enc = _encodestring(s, quotetabs=True)
# Must encode spaces, which quopri.encodestring() doesn't do
Expand All @@ -34,7 +34,7 @@ def encode_base64(msg):
msg['Content-Transfer-Encoding'] = 'base64'



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def encode_quopri(msg):
"""Encode the message's payload in quoted-printable.

Expand All @@ -46,7 +46,7 @@ def encode_quopri(msg):
msg['Content-Transfer-Encoding'] = 'quoted-printable'



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload(decode=True)
Expand All @@ -64,6 +64,6 @@ def encode_7or8bit(msg):
msg['Content-Transfer-Encoding'] = '7bit'



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def encode_noop(msg):
"""Do nothing."""
4 changes: 2 additions & 2 deletions Lib/email/feedparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
NeedMoreData = object()



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class BufferedSubFile(object):
"""A file-ish object that can have new data loaded into it.

Expand Down Expand Up @@ -132,7 +132,7 @@ def __next__(self):
return line



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class FeedParser:
"""A feed-style parser of email."""

Expand Down
8 changes: 4 additions & 4 deletions Lib/email/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
fcre = re.compile(r'^From ', re.MULTILINE)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class Generator:
"""Generates output from a Message object tree.

Expand Down Expand Up @@ -392,7 +392,7 @@ def _make_boundary(cls, text=None):
def _compile_re(cls, s, flags):
return re.compile(s, flags)


Comment thread
AlexWaygood marked this conversation as resolved.
class BytesGenerator(Generator):
"""Generates a bytes version of a Message object tree.

Expand Down Expand Up @@ -443,7 +443,7 @@ def _compile_re(cls, s, flags):
return re.compile(s.encode('ascii'), flags)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
_FMT = '[Non-text (%(type)s) part of message omitted, filename %(filename)s]'

class DecodedGenerator(Generator):
Expand Down Expand Up @@ -503,7 +503,7 @@ def _dispatch(self, msg):
}, file=self)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Helper used by Generator._make_boundary
_width = len(repr(sys.maxsize-1))
_fmt = '%%0%dd' % _width
Expand Down
10 changes: 5 additions & 5 deletions Lib/email/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
_embedded_header = re.compile(r'\n[^ \t]+:')



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# Helpers
_max_append = email.quoprimime._max_append



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def decode_header(header):
"""Decode a message header value without converting charset.

Expand Down Expand Up @@ -152,7 +152,7 @@ def decode_header(header):
return collapsed



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
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()
Expand All @@ -175,7 +175,7 @@ def make_header(decoded_seq, maxlinelen=None, header_name=None,
return h



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class Header:
def __init__(self, s=None, charset=None,
maxlinelen=None, header_name=None,
Expand Down Expand Up @@ -409,7 +409,7 @@ def _normalize(self):
self._chunks = chunks



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class _ValueFormatter:
def __init__(self, headerlen, maxlen, continuation_ws, splitchars):
self._maxlen = maxlen
Expand Down
6 changes: 3 additions & 3 deletions Lib/email/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from io import StringIO



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# This function will become a method of the Message class
def walk(self):
"""Walk over the message tree, yielding each subpart.
Expand All @@ -29,7 +29,7 @@ def walk(self):
yield from subpart.walk()



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
# These two functions are imported into the Iterators.py interface module.
def body_line_iterator(msg, decode=False):
"""Iterate over the parts, returning string payloads line-by-line.
Expand All @@ -55,7 +55,7 @@ def typed_subpart_iterator(msg, maintype='text', subtype=None):
yield subpart



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
def _structure(msg, fp=None, level=0, include_default=False):
"""A handy debugging aid"""
if fp is None:
Expand Down
2 changes: 1 addition & 1 deletion Lib/email/mime/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from email import message



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class MIMEBase(message.Message):
"""Base class for MIME specializations."""

Expand Down
2 changes: 1 addition & 1 deletion Lib/email/mime/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from email.mime.nonmultipart import MIMENonMultipart



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class MIMEMessage(MIMENonMultipart):
"""Class representing message/* MIME documents."""

Expand Down
2 changes: 1 addition & 1 deletion Lib/email/mime/multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from email.mime.base import MIMEBase



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class MIMEMultipart(MIMEBase):
"""Base class for MIME multipart/* type messages."""

Expand Down
2 changes: 1 addition & 1 deletion Lib/email/mime/nonmultipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from email.mime.base import MIMEBase



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class MIMENonMultipart(MIMEBase):
"""Base class for MIME non-multipart type messages."""

Expand Down
2 changes: 1 addition & 1 deletion Lib/email/mime/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from email.mime.nonmultipart import MIMENonMultipart



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class MIMEText(MIMENonMultipart):
"""Class for generating text/* type MIME documents."""

Expand Down
4 changes: 2 additions & 2 deletions Lib/email/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ def parsestr(self, text, headersonly=False):
return self.parse(StringIO(text), headersonly=headersonly)



Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
class HeaderParser(Parser):
def parse(self, fp, headersonly=True):
return Parser.parse(self, fp, True)

def parsestr(self, text, headersonly=True):
return Parser.parsestr(self, text, True)


Comment thread
AlexWaygood marked this conversation as resolved.
class BytesParser:

def __init__(self, *args, **kw):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ async def coro():
with asyncio.Runner() as runner:
with self.assertRaises(asyncio.CancelledError):
runner.run(coro())

def test_signal_install_not_supported_ok(self):
# signal.signal() can throw if the "main thread" doensn't have signals enabled
assert threading.current_thread() is threading.main_thread()
Expand Down
10 changes: 5 additions & 5 deletions Lib/test/test_isinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from test import support



Comment thread
hugovk marked this conversation as resolved.
Outdated
class TestIsInstanceExceptions(unittest.TestCase):
# Test to make sure that an AttributeError when accessing the instance's
# class's bases is masked. This was actually a bug in Python 2.2 and
Expand Down Expand Up @@ -97,7 +97,7 @@ def getclass(self):
class D: pass
self.assertRaises(RuntimeError, isinstance, c, D)


# These tests are similar to above, but tickle certain code paths in
# issubclass() instead of isinstance() -- really PyObject_IsSubclass()
# vs. PyObject_IsInstance().
Expand Down Expand Up @@ -147,7 +147,7 @@ def getbases(self):
self.assertRaises(TypeError, issubclass, B, C())



Comment thread
hugovk marked this conversation as resolved.
Outdated
# meta classes for creating abstract classes and instances
class AbstractClass(object):
def __init__(self, bases):
Expand Down Expand Up @@ -179,7 +179,7 @@ class Super:

class Child(Super):
pass

class TestIsInstanceIsSubclass(unittest.TestCase):
# Tests to ensure that isinstance and issubclass work on abstract
# classes and instances. Before the 2.2 release, TypeErrors were
Expand Down Expand Up @@ -357,6 +357,6 @@ def blowstack(fxn, arg, compare_to):
tuple_arg = (tuple_arg,)
fxn(arg, tuple_arg)


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion Modules/_blake2/blake2module.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
#endif // HAVE_LIBB2

// for secure_zero_memory(), store32(), store48(), and store64()
#include "impl/blake2-impl.h"
#include "impl/blake2-impl.h"

#endif // Py_BLAKE2MODULE_H
4 changes: 2 additions & 2 deletions Modules/_blake2/impl/blake2b-round.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
\
row2l = _mm_roti_epi64(row2l, -24); \
row2h = _mm_roti_epi64(row2h, -24); \

#define G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1) \
row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l); \
row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h); \
Expand All @@ -81,7 +81,7 @@
\
row2l = _mm_roti_epi64(row2l, -63); \
row2h = _mm_roti_epi64(row2h, -63); \

#if defined(HAVE_SSSE3)
#define DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h) \
t0 = _mm_alignr_epi8(row2h, row2l, 8); \
Expand Down
2 changes: 1 addition & 1 deletion Modules/_blake2/impl/blake2s-load-xop.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ buf = _mm_perm_epi8(t1, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(1),TOB(7)) );
#define LOAD_MSG_8_3(buf) \
t0 = _mm_perm_epi8(m0, m2, _mm_set_epi32(TOB(6),TOB(1),TOB(0),TOB(0)) ); \
buf = _mm_perm_epi8(t0, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(5),TOB(4)) ); \

#define LOAD_MSG_8_4(buf) \
buf = _mm_perm_epi8(m0, m1, _mm_set_epi32(TOB(5),TOB(4),TOB(7),TOB(2)) );

Expand Down
Loading