bpo-32297: Few misspellings found in Python source code comments. (#4803)
* Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
This commit is contained in:
parent
5364b5cd75
commit
53f7a7c281
|
@ -21,7 +21,7 @@ print('To:', msg['to'])
|
||||||
print('From:', msg['from'])
|
print('From:', msg['from'])
|
||||||
print('Subject:', msg['subject'])
|
print('Subject:', msg['subject'])
|
||||||
|
|
||||||
# If we want to print a priview of the message content, we can extract whatever
|
# If we want to print a preview of the message content, we can extract whatever
|
||||||
# the least formatted payload is and print the first three lines. Of course,
|
# the least formatted payload is and print the first three lines. Of course,
|
||||||
# if the message has no plain text part printing the first three lines of html
|
# if the message has no plain text part printing the first three lines of html
|
||||||
# is probably useless, but this is just a conceptual example.
|
# is probably useless, but this is just a conceptual example.
|
||||||
|
|
|
@ -188,7 +188,7 @@ native_types = [
|
||||||
(PackedPoint, "B", (), PackedPoint),
|
(PackedPoint, "B", (), PackedPoint),
|
||||||
(Point2, "T{<l:x:<l:y:}".replace('l', s_long), (), Point2),
|
(Point2, "T{<l:x:<l:y:}".replace('l', s_long), (), Point2),
|
||||||
(EmptyStruct, "T{}", (), EmptyStruct),
|
(EmptyStruct, "T{}", (), EmptyStruct),
|
||||||
# the pep does't support unions
|
# the pep doesn't support unions
|
||||||
(aUnion, "B", (), aUnion),
|
(aUnion, "B", (), aUnion),
|
||||||
# structure with sub-arrays
|
# structure with sub-arrays
|
||||||
(StructWithArrays, "T{(2,3)<l:x:(4)T{<l:x:<l:y:}:y:}".replace('l', s_long), (), StructWithArrays),
|
(StructWithArrays, "T{(2,3)<l:x:(4)T{<l:x:<l:y:}:y:}".replace('l', s_long), (), StructWithArrays),
|
||||||
|
|
|
@ -129,7 +129,7 @@ class StructureTestCase(unittest.TestCase):
|
||||||
self.assertEqual(sizeof(XX), 0)
|
self.assertEqual(sizeof(XX), 0)
|
||||||
|
|
||||||
def test_fields(self):
|
def test_fields(self):
|
||||||
# test the offset and size attributes of Structure/Unoin fields.
|
# test the offset and size attributes of Structure/Union fields.
|
||||||
class X(Structure):
|
class X(Structure):
|
||||||
_fields_ = [("x", c_int),
|
_fields_ = [("x", c_int),
|
||||||
("y", c_char)]
|
("y", c_char)]
|
||||||
|
|
|
@ -173,7 +173,7 @@ def body_encode(body, maxlinelen=76, eol=NL):
|
||||||
if not body:
|
if not body:
|
||||||
return body
|
return body
|
||||||
|
|
||||||
# quote speacial characters
|
# quote special characters
|
||||||
body = body.translate(_QUOPRI_BODY_ENCODE_MAP)
|
body = body.translate(_QUOPRI_BODY_ENCODE_MAP)
|
||||||
|
|
||||||
soft_break = '=' + eol
|
soft_break = '=' + eol
|
||||||
|
|
|
@ -538,7 +538,7 @@ class HTTPResponse(io.BufferedIOBase):
|
||||||
chunk_left = self.chunk_left
|
chunk_left = self.chunk_left
|
||||||
if not chunk_left: # Can be 0 or None
|
if not chunk_left: # Can be 0 or None
|
||||||
if chunk_left is not None:
|
if chunk_left is not None:
|
||||||
# We are at the end of chunk. dicard chunk end
|
# We are at the end of chunk, discard chunk end
|
||||||
self._safe_read(2) # toss the CRLF at the end of the chunk
|
self._safe_read(2) # toss the CRLF at the end of the chunk
|
||||||
try:
|
try:
|
||||||
chunk_left = self._read_next_chunk_size()
|
chunk_left = self._read_next_chunk_size()
|
||||||
|
|
|
@ -891,7 +891,7 @@ If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
otherwise return -SIG, where SIG is the signal that killed it. """
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return _spawnvef(mode, file, args, env, execve)
|
return _spawnvef(mode, file, args, env, execve)
|
||||||
|
|
||||||
# Note: spawnvp[e] is't currently supported on Windows
|
# Note: spawnvp[e] isn't currently supported on Windows
|
||||||
|
|
||||||
def spawnvp(mode, file, args):
|
def spawnvp(mode, file, args):
|
||||||
"""spawnvp(mode, file, args) -> integer
|
"""spawnvp(mode, file, args) -> integer
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ class TarInfo(object):
|
||||||
|
|
||||||
# The old GNU sparse format occupies some of the unused
|
# The old GNU sparse format occupies some of the unused
|
||||||
# space in the buffer for up to 4 sparse structures.
|
# space in the buffer for up to 4 sparse structures.
|
||||||
# Save the them for later processing in _proc_sparse().
|
# Save them for later processing in _proc_sparse().
|
||||||
if obj.type == GNUTYPE_SPARSE:
|
if obj.type == GNUTYPE_SPARSE:
|
||||||
pos = 386
|
pos = 386
|
||||||
structs = []
|
structs = []
|
||||||
|
|
|
@ -4115,7 +4115,7 @@ class TestNoForkBomb(unittest.TestCase):
|
||||||
#
|
#
|
||||||
|
|
||||||
class TestForkAwareThreadLock(unittest.TestCase):
|
class TestForkAwareThreadLock(unittest.TestCase):
|
||||||
# We recurisvely start processes. Issue #17555 meant that the
|
# We recursively start processes. Issue #17555 meant that the
|
||||||
# after fork registry would get duplicate entries for the same
|
# after fork registry would get duplicate entries for the same
|
||||||
# lock. The size of the registry at generation n was ~2**n.
|
# lock. The size of the registry at generation n was ~2**n.
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ class UsageTests(unittest.TestCase):
|
||||||
self.raise_fails("spam")
|
self.raise_fails("spam")
|
||||||
|
|
||||||
def test_catch_non_BaseException(self):
|
def test_catch_non_BaseException(self):
|
||||||
# Tryinng to catch an object that does not inherit from BaseException
|
# Trying to catch an object that does not inherit from BaseException
|
||||||
# is not allowed.
|
# is not allowed.
|
||||||
class NonBaseException(object):
|
class NonBaseException(object):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -617,7 +617,7 @@ class ClassTests(unittest.TestCase):
|
||||||
with self.assertRaisesRegex(TypeError, r'C\(\).__init__\(\) takes no arguments'):
|
with self.assertRaisesRegex(TypeError, r'C\(\).__init__\(\) takes no arguments'):
|
||||||
object.__init__(C(), 42)
|
object.__init__(C(), 42)
|
||||||
|
|
||||||
# Class with both `__init__` & `__new__` method overriden
|
# Class with both `__init__` & `__new__` method overridden
|
||||||
class D:
|
class D:
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
super().__new__(cls, *args, **kwargs)
|
super().__new__(cls, *args, **kwargs)
|
||||||
|
|
|
@ -558,7 +558,7 @@ class TestOneTrickPonyABCs(ABCTestCase):
|
||||||
|
|
||||||
c = new_coro()
|
c = new_coro()
|
||||||
self.assertIsInstance(c, Awaitable)
|
self.assertIsInstance(c, Awaitable)
|
||||||
c.close() # awoid RuntimeWarning that coro() was not awaited
|
c.close() # avoid RuntimeWarning that coro() was not awaited
|
||||||
|
|
||||||
class CoroLike: pass
|
class CoroLike: pass
|
||||||
Coroutine.register(CoroLike)
|
Coroutine.register(CoroLike)
|
||||||
|
@ -608,7 +608,7 @@ class TestOneTrickPonyABCs(ABCTestCase):
|
||||||
|
|
||||||
c = new_coro()
|
c = new_coro()
|
||||||
self.assertIsInstance(c, Coroutine)
|
self.assertIsInstance(c, Coroutine)
|
||||||
c.close() # awoid RuntimeWarning that coro() was not awaited
|
c.close() # avoid RuntimeWarning that coro() was not awaited
|
||||||
|
|
||||||
class CoroLike:
|
class CoroLike:
|
||||||
def send(self, value):
|
def send(self, value):
|
||||||
|
@ -1615,7 +1615,7 @@ class TestCollectionABCs(ABCTestCase):
|
||||||
'__len__', '__getitem__', '__setitem__', '__delitem__', 'insert')
|
'__len__', '__getitem__', '__setitem__', '__delitem__', 'insert')
|
||||||
|
|
||||||
def test_MutableSequence_mixins(self):
|
def test_MutableSequence_mixins(self):
|
||||||
# Test the mixins of MutableSequence by creating a miminal concrete
|
# Test the mixins of MutableSequence by creating a minimal concrete
|
||||||
# class inherited from it.
|
# class inherited from it.
|
||||||
class MutableSequenceSubclass(MutableSequence):
|
class MutableSequenceSubclass(MutableSequence):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -998,7 +998,7 @@ class TestCase(unittest.TestCase):
|
||||||
self.assertEqual(C().x, 0)
|
self.assertEqual(C().x, 0)
|
||||||
self.assertEqual(C(2).x, 4)
|
self.assertEqual(C(2).x, 4)
|
||||||
|
|
||||||
# Make sure that if we'r frozen, post-init can't set
|
# Make sure that if we're frozen, post-init can't set
|
||||||
# attributes.
|
# attributes.
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class C:
|
class C:
|
||||||
|
|
|
@ -420,7 +420,7 @@ class TestPartialC(TestPartial, unittest.TestCase):
|
||||||
p.keywords[self] = ['sth2']
|
p.keywords[self] = ['sth2']
|
||||||
return 'astr'
|
return 'astr'
|
||||||
|
|
||||||
# Raplacing the value during key formatting should keep the original
|
# Replacing the value during key formatting should keep the original
|
||||||
# value alive (at least long enough).
|
# value alive (at least long enough).
|
||||||
p.keywords[MutatesYourDict()] = ['sth']
|
p.keywords[MutatesYourDict()] = ['sth']
|
||||||
r = repr(p)
|
r = repr(p)
|
||||||
|
|
|
@ -1458,7 +1458,7 @@ class Knights:
|
||||||
# If we create a square with one exit, we must visit it next;
|
# If we create a square with one exit, we must visit it next;
|
||||||
# else somebody else will have to visit it, and since there's
|
# else somebody else will have to visit it, and since there's
|
||||||
# only one adjacent, there won't be a way to leave it again.
|
# only one adjacent, there won't be a way to leave it again.
|
||||||
# Finelly, if we create more than one free square with a
|
# Finally, if we create more than one free square with a
|
||||||
# single exit, we can only move to one of them next, leaving
|
# single exit, we can only move to one of them next, leaving
|
||||||
# the other one a dead end.
|
# the other one a dead end.
|
||||||
ne0 = ne1 = 0
|
ne0 = ne1 = 0
|
||||||
|
|
|
@ -22,7 +22,7 @@ class FindSpecTests(abc.FinderTests):
|
||||||
# Built-in modules cannot be a package.
|
# Built-in modules cannot be a package.
|
||||||
test_package = None
|
test_package = None
|
||||||
|
|
||||||
# Built-in modules cannobt be in a package.
|
# Built-in modules cannot be in a package.
|
||||||
test_module_in_package = None
|
test_module_in_package = None
|
||||||
|
|
||||||
# Built-in modules cannot be a package.
|
# Built-in modules cannot be a package.
|
||||||
|
|
|
@ -267,7 +267,7 @@ class SimpleTest(abc.LoaderTests):
|
||||||
)
|
)
|
||||||
|
|
||||||
@util.writes_bytecode_files
|
@util.writes_bytecode_files
|
||||||
def test_overriden_checked_hash_based_pyc(self):
|
def test_overridden_checked_hash_based_pyc(self):
|
||||||
with util.create_modules('_temp') as mapping, \
|
with util.create_modules('_temp') as mapping, \
|
||||||
unittest.mock.patch('_imp.check_hash_based_pycs', 'never'):
|
unittest.mock.patch('_imp.check_hash_based_pycs', 'never'):
|
||||||
source = mapping['_temp']
|
source = mapping['_temp']
|
||||||
|
|
|
@ -1569,7 +1569,7 @@ class TestGetattrStatic(unittest.TestCase):
|
||||||
foo.__dict__['d'] = 1
|
foo.__dict__['d'] = 1
|
||||||
self.assertEqual(inspect.getattr_static(foo, 'd'), 1)
|
self.assertEqual(inspect.getattr_static(foo, 'd'), 1)
|
||||||
|
|
||||||
# if the descriptor is a data-desciptor we should return the
|
# if the descriptor is a data-descriptor we should return the
|
||||||
# descriptor
|
# descriptor
|
||||||
descriptor.__set__ = lambda s, i, v: None
|
descriptor.__set__ = lambda s, i, v: None
|
||||||
self.assertEqual(inspect.getattr_static(foo, 'd'), Foo.__dict__['d'])
|
self.assertEqual(inspect.getattr_static(foo, 'd'), Foo.__dict__['d'])
|
||||||
|
|
|
@ -579,7 +579,7 @@ class IOTest(unittest.TestCase):
|
||||||
self.read_ops(f, True)
|
self.read_ops(f, True)
|
||||||
|
|
||||||
def test_large_file_ops(self):
|
def test_large_file_ops(self):
|
||||||
# On Windows and Mac OSX this test comsumes large resources; It takes
|
# On Windows and Mac OSX this test consumes large resources; It takes
|
||||||
# a long time to build the >2 GiB file and takes >2 GiB of disk space
|
# a long time to build the >2 GiB file and takes >2 GiB of disk space
|
||||||
# therefore the resource must be enabled to run this test.
|
# therefore the resource must be enabled to run this test.
|
||||||
if sys.platform[:3] == 'win' or sys.platform == 'darwin':
|
if sys.platform[:3] == 'win' or sys.platform == 'darwin':
|
||||||
|
|
|
@ -141,7 +141,7 @@ def setUpModule():
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# On Windows and Mac OSX this test comsumes large resources; It
|
# On Windows and Mac OSX this test consumes large resources; It
|
||||||
# takes a long time to build the >2 GiB file and takes >2 GiB of disk
|
# takes a long time to build the >2 GiB file and takes >2 GiB of disk
|
||||||
# space therefore the resource must be enabled to run this test.
|
# space therefore the resource must be enabled to run this test.
|
||||||
# If not, nothing after this line stanza will be executed.
|
# If not, nothing after this line stanza will be executed.
|
||||||
|
|
|
@ -178,7 +178,7 @@ class BuiltinLevelsTest(BaseTest):
|
||||||
"""Test builtin levels and their inheritance."""
|
"""Test builtin levels and their inheritance."""
|
||||||
|
|
||||||
def test_flat(self):
|
def test_flat(self):
|
||||||
#Logging levels in a flat logger namespace.
|
# Logging levels in a flat logger namespace.
|
||||||
m = self.next_message
|
m = self.next_message
|
||||||
|
|
||||||
ERR = logging.getLogger("ERR")
|
ERR = logging.getLogger("ERR")
|
||||||
|
@ -248,7 +248,7 @@ class BuiltinLevelsTest(BaseTest):
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_nested_inherited(self):
|
def test_nested_inherited(self):
|
||||||
#Logging levels in a nested namespace, inherited from parent loggers.
|
# Logging levels in a nested namespace, inherited from parent loggers.
|
||||||
m = self.next_message
|
m = self.next_message
|
||||||
|
|
||||||
INF = logging.getLogger("INF")
|
INF = logging.getLogger("INF")
|
||||||
|
@ -1913,9 +1913,9 @@ class EncodingTest(BaseTest):
|
||||||
|
|
||||||
def test_encoding_cyrillic_unicode(self):
|
def test_encoding_cyrillic_unicode(self):
|
||||||
log = logging.getLogger("test")
|
log = logging.getLogger("test")
|
||||||
#Get a message in Unicode: Do svidanya in Cyrillic (meaning goodbye)
|
# Get a message in Unicode: Do svidanya in Cyrillic (meaning goodbye)
|
||||||
message = '\u0434\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f'
|
message = '\u0434\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f'
|
||||||
#Ensure it's written in a Cyrillic encoding
|
# Ensure it's written in a Cyrillic encoding
|
||||||
writer_class = codecs.getwriter('cp1251')
|
writer_class = codecs.getwriter('cp1251')
|
||||||
writer_class.encoding = 'cp1251'
|
writer_class.encoding = 'cp1251'
|
||||||
stream = io.BytesIO()
|
stream = io.BytesIO()
|
||||||
|
@ -1929,7 +1929,7 @@ class EncodingTest(BaseTest):
|
||||||
handler.close()
|
handler.close()
|
||||||
# check we wrote exactly those bytes, ignoring trailing \n etc
|
# check we wrote exactly those bytes, ignoring trailing \n etc
|
||||||
s = stream.getvalue()
|
s = stream.getvalue()
|
||||||
#Compare against what the data should be when encoded in CP-1251
|
# Compare against what the data should be when encoded in CP-1251
|
||||||
self.assertEqual(s, b'\xe4\xee \xf1\xe2\xe8\xe4\xe0\xed\xe8\xff\n')
|
self.assertEqual(s, b'\xe4\xee \xf1\xe2\xe8\xe4\xe0\xed\xe8\xff\n')
|
||||||
|
|
||||||
|
|
||||||
|
@ -1950,7 +1950,7 @@ class WarningsTest(BaseTest):
|
||||||
h.close()
|
h.close()
|
||||||
self.assertGreater(s.find("UserWarning: I'm warning you...\n"), 0)
|
self.assertGreater(s.find("UserWarning: I'm warning you...\n"), 0)
|
||||||
|
|
||||||
#See if an explicit file uses the original implementation
|
# See if an explicit file uses the original implementation
|
||||||
a_file = io.StringIO()
|
a_file = io.StringIO()
|
||||||
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
|
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
|
||||||
a_file, "Dummy line")
|
a_file, "Dummy line")
|
||||||
|
@ -2091,7 +2091,7 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#As config1 but with a misspelt level on a handler
|
# As config1 but with a misspelt level on a handler
|
||||||
config2a = {
|
config2a = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'formatters': {
|
'formatters': {
|
||||||
|
@ -2119,7 +2119,7 @@ class ConfigDictTest(BaseTest):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#As config1 but with a misspelt level on a logger
|
# As config1 but with a misspelt level on a logger
|
||||||
config2b = {
|
config2b = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'formatters': {
|
'formatters': {
|
||||||
|
@ -2286,8 +2286,8 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#config 7 does not define compiler.parser but defines compiler.lexer
|
# config 7 does not define compiler.parser but defines compiler.lexer
|
||||||
#so compiler.parser should be disabled after applying it
|
# so compiler.parser should be disabled after applying it
|
||||||
config7 = {
|
config7 = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'formatters': {
|
'formatters': {
|
||||||
|
@ -2432,7 +2432,7 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#As config1 but with a filter added
|
# As config1 but with a filter added
|
||||||
config10 = {
|
config10 = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'formatters': {
|
'formatters': {
|
||||||
|
@ -2466,7 +2466,7 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#As config1 but using cfg:// references
|
# As config1 but using cfg:// references
|
||||||
config11 = {
|
config11 = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'true_formatters': {
|
'true_formatters': {
|
||||||
|
@ -2497,7 +2497,7 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#As config11 but missing the version key
|
# As config11 but missing the version key
|
||||||
config12 = {
|
config12 = {
|
||||||
'true_formatters': {
|
'true_formatters': {
|
||||||
'form1' : {
|
'form1' : {
|
||||||
|
@ -2527,7 +2527,7 @@ class ConfigDictTest(BaseTest):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#As config11 but using an unsupported version
|
# As config11 but using an unsupported version
|
||||||
config13 = {
|
config13 = {
|
||||||
'version': 2,
|
'version': 2,
|
||||||
'true_formatters': {
|
'true_formatters': {
|
||||||
|
@ -2728,7 +2728,7 @@ class ConfigDictTest(BaseTest):
|
||||||
# Original logger output is empty.
|
# Original logger output is empty.
|
||||||
self.assert_log_lines([])
|
self.assert_log_lines([])
|
||||||
|
|
||||||
#Same as test_config_7_ok but don't disable old loggers.
|
# Same as test_config_7_ok but don't disable old loggers.
|
||||||
def test_config_8_ok(self):
|
def test_config_8_ok(self):
|
||||||
with support.captured_stdout() as output:
|
with support.captured_stdout() as output:
|
||||||
self.apply_config(self.config1)
|
self.apply_config(self.config1)
|
||||||
|
@ -2809,15 +2809,15 @@ class ConfigDictTest(BaseTest):
|
||||||
with support.captured_stdout() as output:
|
with support.captured_stdout() as output:
|
||||||
self.apply_config(self.config9)
|
self.apply_config(self.config9)
|
||||||
logger = logging.getLogger("compiler.parser")
|
logger = logging.getLogger("compiler.parser")
|
||||||
#Nothing will be output since both handler and logger are set to WARNING
|
# Nothing will be output since both handler and logger are set to WARNING
|
||||||
logger.info(self.next_message())
|
logger.info(self.next_message())
|
||||||
self.assert_log_lines([], stream=output)
|
self.assert_log_lines([], stream=output)
|
||||||
self.apply_config(self.config9a)
|
self.apply_config(self.config9a)
|
||||||
#Nothing will be output since both handler is still set to WARNING
|
# Nothing will be output since handler is still set to WARNING
|
||||||
logger.info(self.next_message())
|
logger.info(self.next_message())
|
||||||
self.assert_log_lines([], stream=output)
|
self.assert_log_lines([], stream=output)
|
||||||
self.apply_config(self.config9b)
|
self.apply_config(self.config9b)
|
||||||
#Message should now be output
|
# Message should now be output
|
||||||
logger.info(self.next_message())
|
logger.info(self.next_message())
|
||||||
self.assert_log_lines([
|
self.assert_log_lines([
|
||||||
('INFO', '3'),
|
('INFO', '3'),
|
||||||
|
@ -2829,13 +2829,13 @@ class ConfigDictTest(BaseTest):
|
||||||
logger = logging.getLogger("compiler.parser")
|
logger = logging.getLogger("compiler.parser")
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger('compiler')
|
logger = logging.getLogger('compiler')
|
||||||
#Not output, because filtered
|
# Not output, because filtered
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger('compiler.lexer')
|
logger = logging.getLogger('compiler.lexer')
|
||||||
#Not output, because filtered
|
# Not output, because filtered
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger("compiler.parser.codegen")
|
logger = logging.getLogger("compiler.parser.codegen")
|
||||||
#Output, as not filtered
|
# Output, as not filtered
|
||||||
logger.error(self.next_message())
|
logger.error(self.next_message())
|
||||||
self.assert_log_lines([
|
self.assert_log_lines([
|
||||||
('WARNING', '1'),
|
('WARNING', '1'),
|
||||||
|
@ -2894,13 +2894,13 @@ class ConfigDictTest(BaseTest):
|
||||||
logger = logging.getLogger("compiler.parser")
|
logger = logging.getLogger("compiler.parser")
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger('compiler')
|
logger = logging.getLogger('compiler')
|
||||||
#Not output, because filtered
|
# Not output, because filtered
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger('compiler.lexer')
|
logger = logging.getLogger('compiler.lexer')
|
||||||
#Not output, because filtered
|
# Not output, because filtered
|
||||||
logger.warning(self.next_message())
|
logger.warning(self.next_message())
|
||||||
logger = logging.getLogger("compiler.parser.codegen")
|
logger = logging.getLogger("compiler.parser.codegen")
|
||||||
#Output, as not filtered
|
# Output, as not filtered
|
||||||
logger.error(self.next_message())
|
logger.error(self.next_message())
|
||||||
self.assert_log_lines([
|
self.assert_log_lines([
|
||||||
('WARNING', '1'),
|
('WARNING', '1'),
|
||||||
|
@ -4335,7 +4335,7 @@ class TimedRotatingFileHandlerTest(BaseFileTest):
|
||||||
break
|
break
|
||||||
msg = 'No rotated files found, went back %d seconds' % GO_BACK
|
msg = 'No rotated files found, went back %d seconds' % GO_BACK
|
||||||
if not found:
|
if not found:
|
||||||
#print additional diagnostics
|
# print additional diagnostics
|
||||||
dn, fn = os.path.split(self.fn)
|
dn, fn = os.path.split(self.fn)
|
||||||
files = [f for f in os.listdir(dn) if f.startswith(fn)]
|
files = [f for f in os.listdir(dn) if f.startswith(fn)]
|
||||||
print('Test time: %s' % now.strftime("%Y-%m-%d %H-%M-%S"), file=sys.stderr)
|
print('Test time: %s' % now.strftime("%Y-%m-%d %H-%M-%S"), file=sys.stderr)
|
||||||
|
|
|
@ -1423,7 +1423,7 @@ class MathTests(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class IsCloseTests(unittest.TestCase):
|
class IsCloseTests(unittest.TestCase):
|
||||||
isclose = math.isclose # sublcasses should override this
|
isclose = math.isclose # subclasses should override this
|
||||||
|
|
||||||
def assertIsClose(self, a, b, *args, **kwargs):
|
def assertIsClose(self, a, b, *args, **kwargs):
|
||||||
self.assertTrue(self.isclose(a, b, *args, **kwargs),
|
self.assertTrue(self.isclose(a, b, *args, **kwargs),
|
||||||
|
|
|
@ -30,7 +30,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
||||||
self.roundtrip(parser.expr, s)
|
self.roundtrip(parser.expr, s)
|
||||||
|
|
||||||
def test_flags_passed(self):
|
def test_flags_passed(self):
|
||||||
# The unicode literals flags has to be passed from the paser to AST
|
# The unicode literals flags has to be passed from the parser to AST
|
||||||
# generation.
|
# generation.
|
||||||
suite = parser.suite("from __future__ import unicode_literals; x = ''")
|
suite = parser.suite("from __future__ import unicode_literals; x = ''")
|
||||||
code = suite.compile()
|
code = suite.compile()
|
||||||
|
|
|
@ -24,7 +24,7 @@ class TestBasicOps:
|
||||||
self.gen.seed()
|
self.gen.seed()
|
||||||
state1 = self.gen.getstate()
|
state1 = self.gen.getstate()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
self.gen.seed() # diffent seeds at different times
|
self.gen.seed() # different seeds at different times
|
||||||
state2 = self.gen.getstate()
|
state2 = self.gen.getstate()
|
||||||
self.assertNotEqual(state1, state2)
|
self.assertNotEqual(state1, state2)
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ class HelperFunctionsTests(unittest.TestCase):
|
||||||
'site-packages')
|
'site-packages')
|
||||||
self.assertEqual(dirs[1], wanted)
|
self.assertEqual(dirs[1], wanted)
|
||||||
elif os.sep == '/':
|
elif os.sep == '/':
|
||||||
# OS X non-framwework builds, Linux, FreeBSD, etc
|
# OS X non-framework builds, Linux, FreeBSD, etc
|
||||||
self.assertEqual(len(dirs), 1)
|
self.assertEqual(len(dirs), 1)
|
||||||
wanted = os.path.join('xoxo', 'lib',
|
wanted = os.path.join('xoxo', 'lib',
|
||||||
'python%d.%d' % sys.version_info[:2],
|
'python%d.%d' % sys.version_info[:2],
|
||||||
|
|
|
@ -1444,7 +1444,7 @@ class GeneralModuleTests(unittest.TestCase):
|
||||||
socket.gethostbyname(domain)
|
socket.gethostbyname(domain)
|
||||||
socket.gethostbyname_ex(domain)
|
socket.gethostbyname_ex(domain)
|
||||||
socket.getaddrinfo(domain,0,socket.AF_UNSPEC,socket.SOCK_STREAM)
|
socket.getaddrinfo(domain,0,socket.AF_UNSPEC,socket.SOCK_STREAM)
|
||||||
# this may not work if the forward lookup choses the IPv6 address, as that doesn't
|
# this may not work if the forward lookup chooses the IPv6 address, as that doesn't
|
||||||
# have a reverse entry yet
|
# have a reverse entry yet
|
||||||
# socket.gethostbyaddr('испытание.python.org')
|
# socket.gethostbyaddr('испытание.python.org')
|
||||||
|
|
||||||
|
@ -4399,7 +4399,7 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):
|
||||||
self.write_file.write(self.write_msg)
|
self.write_file.write(self.write_msg)
|
||||||
self.write_file.flush()
|
self.write_file.flush()
|
||||||
self.evt2.set()
|
self.evt2.set()
|
||||||
# Avoid cloding the socket before the server test has finished,
|
# Avoid closing the socket before the server test has finished,
|
||||||
# otherwise system recv() will return 0 instead of EWOULDBLOCK.
|
# otherwise system recv() will return 0 instead of EWOULDBLOCK.
|
||||||
self.serv_finished.wait(5.0)
|
self.serv_finished.wait(5.0)
|
||||||
|
|
||||||
|
|
|
@ -850,7 +850,7 @@ class BasicSocketTests(unittest.TestCase):
|
||||||
self.cert_time_ok("Jan 5 09:34:61 2018 GMT", 1515144901)
|
self.cert_time_ok("Jan 5 09:34:61 2018 GMT", 1515144901)
|
||||||
self.cert_time_fail("Jan 5 09:34:62 2018 GMT") # invalid seconds
|
self.cert_time_fail("Jan 5 09:34:62 2018 GMT") # invalid seconds
|
||||||
|
|
||||||
# no special treatement for the special value:
|
# no special treatment for the special value:
|
||||||
# 99991231235959Z (rfc 5280)
|
# 99991231235959Z (rfc 5280)
|
||||||
self.cert_time_ok("Dec 31 23:59:59 9999 GMT", 253402300799.0)
|
self.cert_time_ok("Dec 31 23:59:59 9999 GMT", 253402300799.0)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ basic.events = [(0, 'call'),
|
||||||
|
|
||||||
# Many of the tests below are tricky because they involve pass statements.
|
# Many of the tests below are tricky because they involve pass statements.
|
||||||
# If there is implicit control flow around a pass statement (in an except
|
# If there is implicit control flow around a pass statement (in an except
|
||||||
# clause or else caluse) under what conditions do you set a line number
|
# clause or else clause) under what conditions do you set a line number
|
||||||
# following that clause?
|
# following that clause?
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2332,7 +2332,7 @@ class ElementIterTest(unittest.TestCase):
|
||||||
sourcefile = serialize(doc, to_string=False)
|
sourcefile = serialize(doc, to_string=False)
|
||||||
self.assertEqual(next(ET.iterparse(sourcefile))[0], 'end')
|
self.assertEqual(next(ET.iterparse(sourcefile))[0], 'end')
|
||||||
|
|
||||||
# With an explitit parser too (issue #9708)
|
# With an explicit parser too (issue #9708)
|
||||||
sourcefile = serialize(doc, to_string=False)
|
sourcefile = serialize(doc, to_string=False)
|
||||||
parser = ET.XMLParser(target=ET.TreeBuilder())
|
parser = ET.XMLParser(target=ET.TreeBuilder())
|
||||||
self.assertEqual(next(ET.iterparse(sourcefile, parser=parser))[0],
|
self.assertEqual(next(ET.iterparse(sourcefile, parser=parser))[0],
|
||||||
|
|
|
@ -365,7 +365,7 @@ class ZipAppCmdlineTest(unittest.TestCase):
|
||||||
args = [str(original), '-o', str(original)]
|
args = [str(original), '-o', str(original)]
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
zipapp.main(args)
|
zipapp.main(args)
|
||||||
# Program should exit with a non-zero returm code.
|
# Program should exit with a non-zero return code.
|
||||||
self.assertTrue(cm.exception.code)
|
self.assertTrue(cm.exception.code)
|
||||||
|
|
||||||
def test_cmdline_copy_change_main(self):
|
def test_cmdline_copy_change_main(self):
|
||||||
|
@ -375,7 +375,7 @@ class ZipAppCmdlineTest(unittest.TestCase):
|
||||||
args = [str(original), '-o', str(target), '-m', 'foo:bar']
|
args = [str(original), '-o', str(target), '-m', 'foo:bar']
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
zipapp.main(args)
|
zipapp.main(args)
|
||||||
# Program should exit with a non-zero returm code.
|
# Program should exit with a non-zero return code.
|
||||||
self.assertTrue(cm.exception.code)
|
self.assertTrue(cm.exception.code)
|
||||||
|
|
||||||
@patch('sys.stdout', new_callable=io.StringIO)
|
@patch('sys.stdout', new_callable=io.StringIO)
|
||||||
|
@ -385,7 +385,7 @@ class ZipAppCmdlineTest(unittest.TestCase):
|
||||||
args = [str(target), '--info']
|
args = [str(target), '--info']
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
zipapp.main(args)
|
zipapp.main(args)
|
||||||
# Program should exit with a zero returm code.
|
# Program should exit with a zero return code.
|
||||||
self.assertEqual(cm.exception.code, 0)
|
self.assertEqual(cm.exception.code, 0)
|
||||||
self.assertEqual(mock_stdout.getvalue(), "Interpreter: <none>\n")
|
self.assertEqual(mock_stdout.getvalue(), "Interpreter: <none>\n")
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ class ZipAppCmdlineTest(unittest.TestCase):
|
||||||
args = [str(target), '--info']
|
args = [str(target), '--info']
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
zipapp.main(args)
|
zipapp.main(args)
|
||||||
# Program should exit with a non-zero returm code.
|
# Program should exit with a non-zero return code.
|
||||||
self.assertTrue(cm.exception.code)
|
self.assertTrue(cm.exception.code)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ class InternalFunctionsTest(unittest.TestCase):
|
||||||
# but when passing a single state, it can be anything
|
# but when passing a single state, it can be anything
|
||||||
valid = {'opt': [[1, 'value']]}
|
valid = {'opt': [[1, 'value']]}
|
||||||
self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value'))
|
self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value'))
|
||||||
# special attention to single states which evalute to False
|
# special attention to single states which evaluate to False
|
||||||
for stateval in (None, 0, False, '', set()): # just some samples
|
for stateval in (None, 0, False, '', set()): # just some samples
|
||||||
valid = {'opt': [(stateval, 'value')]}
|
valid = {'opt': [(stateval, 'value')]}
|
||||||
self.assertEqual(ttk._format_mapdict(valid),
|
self.assertEqual(ttk._format_mapdict(valid),
|
||||||
|
@ -251,7 +251,7 @@ class InternalFunctionsTest(unittest.TestCase):
|
||||||
self.assertEqual(ttk._format_layoutlist([])[0], '')
|
self.assertEqual(ttk._format_layoutlist([])[0], '')
|
||||||
|
|
||||||
# _format_layoutlist always expects the second item (in every item)
|
# _format_layoutlist always expects the second item (in every item)
|
||||||
# to act like a dict (except when the value evalutes to False).
|
# to act like a dict (except when the value evaluates to False).
|
||||||
self.assertRaises(AttributeError,
|
self.assertRaises(AttributeError,
|
||||||
ttk._format_layoutlist, [('a', 'b')])
|
ttk._format_layoutlist, [('a', 'b')])
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ def _mapdict_values(items):
|
||||||
# ['active selected', 'grey', 'focus', [1, 2, 3, 4]]
|
# ['active selected', 'grey', 'focus', [1, 2, 3, 4]]
|
||||||
opt_val = []
|
opt_val = []
|
||||||
for *state, val in items:
|
for *state, val in items:
|
||||||
# hacks for bakward compatibility
|
# hacks for backward compatibility
|
||||||
state[0] # raise IndexError if empty
|
state[0] # raise IndexError if empty
|
||||||
if len(state) == 1:
|
if len(state) == 1:
|
||||||
# if it is empty (something that evaluates to False), then
|
# if it is empty (something that evaluates to False), then
|
||||||
|
|
|
@ -259,7 +259,7 @@ class DemoWindow(object):
|
||||||
return 'break'
|
return 'break'
|
||||||
|
|
||||||
def update_mousewheel(self, event):
|
def update_mousewheel(self, event):
|
||||||
# For wheel up, event.delte = 120 on Windows, -1 on darwin.
|
# For wheel up, event.delta = 120 on Windows, -1 on darwin.
|
||||||
# X-11 sends Control-Button-4 event instead.
|
# X-11 sends Control-Button-4 event instead.
|
||||||
if (event.delta < 0) == (not darwin):
|
if (event.delta < 0) == (not darwin):
|
||||||
return self.decrease_size()
|
return self.decrease_size()
|
||||||
|
|
|
@ -450,7 +450,7 @@ class TestMockingMagicMethods(unittest.TestCase):
|
||||||
self.assertIsInstance(bar_direct, MagicMock)
|
self.assertIsInstance(bar_direct, MagicMock)
|
||||||
|
|
||||||
# http://bugs.python.org/issue23310
|
# http://bugs.python.org/issue23310
|
||||||
# Check if you can change behaviour of magic methds in MagicMock init
|
# Check if you can change behaviour of magic methods in MagicMock init
|
||||||
def test_magic_in_initialization(self):
|
def test_magic_in_initialization(self):
|
||||||
m = MagicMock(**{'__str__.return_value': "12"})
|
m = MagicMock(**{'__str__.return_value': "12"})
|
||||||
self.assertEqual(str(m), "12")
|
self.assertEqual(str(m), "12")
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ def _escape_cdata(text):
|
||||||
# escape character data
|
# escape character data
|
||||||
try:
|
try:
|
||||||
# it's worth avoiding do-nothing calls for strings that are
|
# it's worth avoiding do-nothing calls for strings that are
|
||||||
# shorter than 500 character, or so. assume that's, by far,
|
# shorter than 500 characters, or so. assume that's, by far,
|
||||||
# the most common case in most applications.
|
# the most common case in most applications.
|
||||||
if "&" in text:
|
if "&" in text:
|
||||||
text = text.replace("&", "&")
|
text = text.replace("&", "&")
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ class Transport:
|
||||||
accept_gzip_encoding = True
|
accept_gzip_encoding = True
|
||||||
|
|
||||||
# if positive, encode request using gzip if it exceeds this threshold
|
# if positive, encode request using gzip if it exceeds this threshold
|
||||||
# note that many server will get confused, so only use it if you know
|
# note that many servers will get confused, so only use it if you know
|
||||||
# that they can decode such a request
|
# that they can decode such a request
|
||||||
encode_threshold = None #None = don't encode
|
encode_threshold = None #None = don't encode
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ class Transport:
|
||||||
# Send HTTP request.
|
# Send HTTP request.
|
||||||
#
|
#
|
||||||
# @param host Host descriptor (URL or (URL, x509 info) tuple).
|
# @param host Host descriptor (URL or (URL, x509 info) tuple).
|
||||||
# @param handler Targer RPC handler (a path relative to host)
|
# @param handler Target RPC handler (a path relative to host)
|
||||||
# @param request_body The XML-RPC request body
|
# @param request_body The XML-RPC request body
|
||||||
# @param debug Enable debugging if debug is true.
|
# @param debug Enable debugging if debug is true.
|
||||||
# @return An HTTPConnection.
|
# @return An HTTPConnection.
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ def buildLibraries():
|
||||||
|
|
||||||
def buildPythonDocs():
|
def buildPythonDocs():
|
||||||
# This stores the documentation as Resources/English.lproj/Documentation
|
# This stores the documentation as Resources/English.lproj/Documentation
|
||||||
# inside the framwork. pydoc and IDLE will pick it up there.
|
# inside the framework. pydoc and IDLE will pick it up there.
|
||||||
print("Install python documentation")
|
print("Install python documentation")
|
||||||
rootDir = os.path.join(WORKDIR, '_root')
|
rootDir = os.path.join(WORKDIR, '_root')
|
||||||
buildDir = os.path.join('../../Doc')
|
buildDir = os.path.join('../../Doc')
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait until the thread completes: it will never occur, since Py_FatalError()
|
/* wait until the thread completes: it will never occur, since Py_FatalError()
|
||||||
exits the process immedialty. */
|
exits the process immediately. */
|
||||||
PyThread_acquire_lock(lock, WAIT_LOCK);
|
PyThread_acquire_lock(lock, WAIT_LOCK);
|
||||||
PyThread_release_lock(lock);
|
PyThread_release_lock(lock);
|
||||||
PyThread_free_lock(lock);
|
PyThread_free_lock(lock);
|
||||||
|
|
|
@ -135,7 +135,7 @@ def _is_exception(name):
|
||||||
|
|
||||||
def _is_compiler(name):
|
def _is_compiler(name):
|
||||||
return (
|
return (
|
||||||
# Python/Pythyon-ast.c
|
# Python/Python-ast.c
|
||||||
name.endswith('_type') or
|
name.endswith('_type') or
|
||||||
name.endswith('_singleton') or
|
name.endswith('_singleton') or
|
||||||
name.endswith('_attributes')
|
name.endswith('_attributes')
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1399,7 +1399,7 @@ class PyBuildExt(build_ext):
|
||||||
if host_platform == 'darwin':
|
if host_platform == 'darwin':
|
||||||
# On OS X, there is no separate /usr/lib/libncursesw nor
|
# On OS X, there is no separate /usr/lib/libncursesw nor
|
||||||
# libpanelw. If we are here, we found a locally-supplied
|
# libpanelw. If we are here, we found a locally-supplied
|
||||||
# version of libncursesw. There should be also be a
|
# version of libncursesw. There should also be a
|
||||||
# libpanelw. _XOPEN_SOURCE defines are usually excluded
|
# libpanelw. _XOPEN_SOURCE defines are usually excluded
|
||||||
# for OS X but we need _XOPEN_SOURCE_EXTENDED here for
|
# for OS X but we need _XOPEN_SOURCE_EXTENDED here for
|
||||||
# ncurses wide char support
|
# ncurses wide char support
|
||||||
|
|
Loading…
Reference in New Issue