mirror of
https://github.com/python/cpython.git
synced 2025-11-14 07:49:28 +00:00
Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
This commit is contained in:
commit
b6a9c9761c
68 changed files with 93 additions and 92 deletions
|
|
@ -252,7 +252,7 @@ class InvalidOperation(DecimalException):
|
|||
class ConversionSyntax(InvalidOperation):
|
||||
"""Trying to convert badly formed string.
|
||||
|
||||
This occurs and signals invalid-operation if an string is being
|
||||
This occurs and signals invalid-operation if a string is being
|
||||
converted to a number and it does not conform to the numeric string
|
||||
syntax. The result is [0,qNaN].
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ class IOBase(metaclass=abc.ABCMeta):
|
|||
return self.__closed
|
||||
|
||||
def _checkClosed(self, msg=None):
|
||||
"""Internal: raise an ValueError if file is closed
|
||||
"""Internal: raise a ValueError if file is closed
|
||||
"""
|
||||
if self.closed:
|
||||
raise ValueError("I/O operation on closed file."
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
|
||||
The address must be already resolved to avoid the trap of hanging the
|
||||
entire event loop when the address requires doing a DNS lookup. For
|
||||
example, it must be an IP address, not an hostname, for AF_INET and
|
||||
example, it must be an IP address, not a hostname, for AF_INET and
|
||||
AF_INET6 address families. Use getaddrinfo() to resolve the hostname
|
||||
asynchronously.
|
||||
|
||||
|
|
|
|||
|
|
@ -1522,7 +1522,7 @@ def get_qp_ctext(value):
|
|||
This is not the RFC ctext, since we are handling nested comments in comment
|
||||
and unquoting quoted-pairs here. We allow anything except the '()'
|
||||
characters, but if we find any ASCII other than the RFC defined printable
|
||||
ASCII an NonPrintableDefect is added to the token's defects list. Since
|
||||
ASCII, a NonPrintableDefect is added to the token's defects list. Since
|
||||
quoted pairs are converted to their unquoted values, what is returned is
|
||||
a 'ptext' token. In this case it is a WhiteSpaceTerminal, so it's value
|
||||
is ' '.
|
||||
|
|
@ -1537,7 +1537,7 @@ def get_qcontent(value):
|
|||
"""qcontent = qtext / quoted-pair
|
||||
|
||||
We allow anything except the DQUOTE character, but if we find any ASCII
|
||||
other than the RFC defined printable ASCII an NonPrintableDefect is
|
||||
other than the RFC defined printable ASCII, a NonPrintableDefect is
|
||||
added to the token's defects list. Any quoted pairs are converted to their
|
||||
unquoted values, so what is returned is a 'ptext' token. In this case it
|
||||
is a ValueTerminal.
|
||||
|
|
@ -1882,7 +1882,7 @@ def get_dtext(value):
|
|||
obs-dtext = obs-NO-WS-CTL / quoted-pair
|
||||
|
||||
We allow anything except the excluded characters, but if we find any
|
||||
ASCII other than the RFC defined printable ASCII an NonPrintableDefect is
|
||||
ASCII other than the RFC defined printable ASCII, a NonPrintableDefect is
|
||||
added to the token's defects list. Quoted pairs are converted to their
|
||||
unquoted values, so what is returned is a ptext token, in this case a
|
||||
ValueTerminal. If there were quoted-printables, an ObsoleteHeaderDefect is
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class Group:
|
|||
def __init__(self, display_name=None, addresses=None):
|
||||
"""Create an object representing an address group.
|
||||
|
||||
An address group consists of a display_name followed by colon and an
|
||||
An address group consists of a display_name followed by colon and a
|
||||
list of addresses (see Address) terminated by a semi-colon. The Group
|
||||
is created by specifying a display_name and a possibly empty list of
|
||||
Address objects. A Group can also be used to represent a single
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class AutoComplete:
|
|||
|
||||
def try_open_completions_event(self, event):
|
||||
"""Happens when it would be nice to open a completion list, but not
|
||||
really necessary, for example after an dot, so function
|
||||
really necessary, for example after a dot, so function
|
||||
calls won't be made.
|
||||
"""
|
||||
lastchar = self.text.get("insert-1c")
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ class StackViewer(ScrolledList):
|
|||
def __init__(self, master, flist, gui):
|
||||
if macosxSupport.isAquaTk():
|
||||
# At least on with the stock AquaTk version on OSX 10.4 you'll
|
||||
# get an shaking GUI that eventually kills IDLE if the width
|
||||
# get a shaking GUI that eventually kills IDLE if the width
|
||||
# argument is specified.
|
||||
ScrolledList.__init__(self, master)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class WidgetRedirector:
|
|||
'''Return OriginalCommand(operation) after registering function.
|
||||
|
||||
Registration adds an operation: function pair to ._operations.
|
||||
It also adds an widget function attribute that masks the tkinter
|
||||
It also adds a widget function attribute that masks the tkinter
|
||||
class instance method. Method masking operates independently
|
||||
from command dispatch.
|
||||
|
||||
|
|
|
|||
|
|
@ -1196,7 +1196,7 @@ class ConfigDialog(Toplevel):
|
|||
|
||||
All values are treated as text, and it is up to the user to supply
|
||||
reasonable values. The only exception to this are the 'enable*' options,
|
||||
which are boolean, and can be toggled with an True/False button.
|
||||
which are boolean, and can be toggled with a True/False button.
|
||||
"""
|
||||
parent = self.parent
|
||||
frame = self.tabPages.pages['Extensions'].frame
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class BaseFix(object):
|
|||
"""Initializer. Subclass may override.
|
||||
|
||||
Args:
|
||||
options: an dict containing the options passed to RefactoringTool
|
||||
options: a dict containing the options passed to RefactoringTool
|
||||
that could be used to customize the fixer through the command line.
|
||||
log: a list to append warnings and other messages to.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class RefactoringTool(object):
|
|||
|
||||
Args:
|
||||
fixer_names: a list of fixers to import
|
||||
options: an dict with configuration.
|
||||
options: a dict with configuration.
|
||||
explicit: a list of fixers to run even if they are explicit.
|
||||
"""
|
||||
self.fixers = fixer_names
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ def open(filename, mode="rb", *,
|
|||
constructor: LZMAFile(filename, mode, ...). In this case, the
|
||||
encoding, errors and newline arguments must not be provided.
|
||||
|
||||
For text mode, a LZMAFile object is created, and wrapped in an
|
||||
For text mode, an LZMAFile object is created, and wrapped in an
|
||||
io.TextIOWrapper instance with the specified encoding, error
|
||||
handling behavior, and line ending(s).
|
||||
|
||||
|
|
|
|||
|
|
@ -1821,7 +1821,7 @@ class BabylMessage(Message):
|
|||
_type_specific_attributes = ['_labels', '_visible']
|
||||
|
||||
def __init__(self, message=None):
|
||||
"""Initialize an BabylMessage instance."""
|
||||
"""Initialize a BabylMessage instance."""
|
||||
self._labels = []
|
||||
self._visible = Message()
|
||||
Message.__init__(self, message)
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ def RebuildProxy(func, token, serializer, kwds):
|
|||
|
||||
def MakeProxyType(name, exposed, _cache={}):
|
||||
'''
|
||||
Return an proxy type whose methods are given by `exposed`
|
||||
Return a proxy type whose methods are given by `exposed`
|
||||
'''
|
||||
exposed = tuple(exposed)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1362,7 +1362,7 @@ class OptionParser (OptionContainer):
|
|||
sys.argv[1:]). Any errors result in a call to 'error()', which
|
||||
by default prints the usage message to stderr and calls
|
||||
sys.exit() with an error message. On success returns a pair
|
||||
(values, args) where 'values' is an Values instance (with all
|
||||
(values, args) where 'values' is a Values instance (with all
|
||||
your option values) and 'args' is the list of arguments left
|
||||
over after parsing options.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def isrecursive(object):
|
|||
class _safe_key:
|
||||
"""Helper function for key functions when sorting unorderable objects.
|
||||
|
||||
The wrapped-object will fallback to an Py2.x style comparison for
|
||||
The wrapped-object will fallback to a Py2.x style comparison for
|
||||
unorderable types (sorting first comparing the type name and then by
|
||||
the obj ids). Does not work recursively, so dict.items() must have
|
||||
_safe_key applied to both the key and the value.
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
|
|||
global default timeout setting returned by :func:`getdefaulttimeout`
|
||||
is used. If *source_address* is set it must be a tuple of (host, port)
|
||||
for the socket to bind as a source address before making the connection.
|
||||
An host of '' or port 0 tells the OS to use the default.
|
||||
A host of '' or port 0 tells the OS to use the default.
|
||||
"""
|
||||
|
||||
host, port = address
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ class StreamRequestHandler(BaseRequestHandler):
|
|||
try:
|
||||
self.wfile.flush()
|
||||
except socket.error:
|
||||
# An final socket error may have occurred here, such as
|
||||
# A final socket error may have occurred here, such as
|
||||
# the local error ECONNABORTED.
|
||||
pass
|
||||
self.wfile.close()
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class RegressionTests(unittest.TestCase):
|
|||
def CheckStatementFinalizationOnCloseDb(self):
|
||||
# pysqlite versions <= 2.3.3 only finalized statements in the statement
|
||||
# cache when closing the database. statements that were still
|
||||
# referenced in cursors weren't closed an could provoke "
|
||||
# referenced in cursors weren't closed and could provoke "
|
||||
# "OperationalError: Unable to close due to unfinalised statements".
|
||||
con = sqlite.connect(":memory:")
|
||||
cursors = []
|
||||
|
|
|
|||
|
|
@ -1528,9 +1528,9 @@ class TarFile(object):
|
|||
|
||||
'x' or 'x:' create a tarfile exclusively without compression, raise
|
||||
an exception if the file is already created
|
||||
'x:gz' create an gzip compressed tarfile, raise an exception
|
||||
'x:gz' create a gzip compressed tarfile, raise an exception
|
||||
if the file is already created
|
||||
'x:bz2' create an bzip2 compressed tarfile, raise an exception
|
||||
'x:bz2' create a bzip2 compressed tarfile, raise an exception
|
||||
if the file is already created
|
||||
'x:xz' create an lzma compressed tarfile, raise an exception
|
||||
if the file is already created
|
||||
|
|
|
|||
|
|
@ -1182,7 +1182,7 @@ class SelectorSslTransportTests(test_utils.TestCase):
|
|||
self.assertIs(exc, waiter.exception())
|
||||
|
||||
def test_cancel_handshake(self):
|
||||
# Python issue #23197: cancelling an handshake must not raise an
|
||||
# Python issue #23197: cancelling a handshake must not raise an
|
||||
# exception or log an error, even if the handshake failed
|
||||
waiter = asyncio.Future(loop=self.loop)
|
||||
transport = self.ssl_transport(waiter=waiter)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class SslProtoHandshakeTests(test_utils.TestCase):
|
|||
ssl_proto.connection_made(transport)
|
||||
|
||||
def test_cancel_handshake(self):
|
||||
# Python issue #23197: cancelling an handshake must not raise an
|
||||
# Python issue #23197: cancelling a handshake must not raise an
|
||||
# exception or log an error, even if the handshake failed
|
||||
waiter = asyncio.Future(loop=self.loop)
|
||||
ssl_proto = self.ssl_protocol(waiter)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Rat(object):
|
|||
den = property(_get_den, None)
|
||||
|
||||
def __repr__(self):
|
||||
"""Convert a Rat to an string resembling a Rat constructor call."""
|
||||
"""Convert a Rat to a string resembling a Rat constructor call."""
|
||||
return "Rat(%d, %d)" % (self.__num, self.__den)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ class FaultHandlerTests(unittest.TestCase):
|
|||
sys.stderr = stderr
|
||||
|
||||
def test_stderr_None(self):
|
||||
# Issue #21497: provide an helpful error if sys.stderr is None,
|
||||
# Issue #21497: provide a helpful error if sys.stderr is None,
|
||||
# instead of just an attribute error: "None has no attribute fileno".
|
||||
with self.check_stderr_none():
|
||||
faulthandler.enable()
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class _BasePurePathTest(object):
|
|||
|
||||
def _check_str_subclass(self, *args):
|
||||
# Issue #21127: it should be possible to construct a PurePath object
|
||||
# from an str subclass instance, and it then gets converted to
|
||||
# from a str subclass instance, and it then gets converted to
|
||||
# a pure str object.
|
||||
class StrSubclass(str):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ class SysModuleTest(unittest.TestCase):
|
|||
self.assertEqual(os.path.abspath(sys.executable), sys.executable)
|
||||
|
||||
# Issue #7774: Ensure that sys.executable is an empty string if argv[0]
|
||||
# has been set to an non existent program name and Python is unable to
|
||||
# has been set to a non existent program name and Python is unable to
|
||||
# retrieve the real program name
|
||||
|
||||
# For a normal installation, it should work without 'cwd'
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,7 @@ class EventTests(lock_tests.EventTests):
|
|||
eventtype = staticmethod(threading.Event)
|
||||
|
||||
class ConditionAsRLockTests(lock_tests.RLockTests):
|
||||
# An Condition uses an RLock by default and exports its API.
|
||||
# Condition uses an RLock by default and exports its API.
|
||||
locktype = staticmethod(threading.Condition)
|
||||
|
||||
class ConditionTests(lock_tests.ConditionTests):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Gprof2htmlTests(unittest.TestCase):
|
|||
sys.argv = []
|
||||
|
||||
def test_gprof(self):
|
||||
# Issue #14508: this used to fail with an NameError.
|
||||
# Issue #14508: this used to fail with a NameError.
|
||||
with mock.patch.object(self.gprof, 'webbrowser') as wmock, \
|
||||
tempfile.TemporaryDirectory() as tmpdir:
|
||||
fn = os.path.join(tmpdir, 'abc')
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class ZipAppTest(unittest.TestCase):
|
|||
self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n'))
|
||||
|
||||
def test_read_from_pathobj(self):
|
||||
# Test that we can copy an archive using an pathlib.Path object
|
||||
# Test that we can copy an archive using a pathlib.Path object
|
||||
# for the source.
|
||||
source = self.tmpdir / 'source'
|
||||
source.mkdir()
|
||||
|
|
|
|||
|
|
@ -2771,7 +2771,7 @@ class Menu(Widget):
|
|||
self.deletecommand(c)
|
||||
self.tk.call(self._w, 'delete', index1, index2)
|
||||
def entrycget(self, index, option):
|
||||
"""Return the resource value of an menu item for OPTION at INDEX."""
|
||||
"""Return the resource value of a menu item for OPTION at INDEX."""
|
||||
return self.tk.call(self._w, 'entrycget', index, '-' + option)
|
||||
def entryconfigure(self, index, cnf=None, **kw):
|
||||
"""Configure a menu item at INDEX."""
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
This is very preliminary. I currently only support dnd *within* one
|
||||
application, between different windows (or within the same window).
|
||||
|
||||
I an trying to make this as generic as possible -- not dependent on
|
||||
I am trying to make this as generic as possible -- not dependent on
|
||||
the use of a particular widget or icon type, etc. I also hope that
|
||||
this will work with Pmw.
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class InternalFunctionsTest(unittest.TestCase):
|
|||
|
||||
## Testing type = vsapi
|
||||
# vsapi type expects at least a class name and a part_id, so this
|
||||
# should raise an ValueError since it tries to get two elements from
|
||||
# should raise a ValueError since it tries to get two elements from
|
||||
# an empty tuple
|
||||
self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi')
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class Tk(tkinter.Tk, tixCommand):
|
|||
self.tk.eval('package require Tix')
|
||||
|
||||
def destroy(self):
|
||||
# For safety, remove an delete_window binding before destroy
|
||||
# For safety, remove the delete_window binding before destroy
|
||||
self.protocol("WM_DELETE_WINDOW", "")
|
||||
tkinter.Tk.destroy(self)
|
||||
|
||||
|
|
@ -702,7 +702,7 @@ class DirSelectBox(TixWidget):
|
|||
|
||||
class ExFileSelectBox(TixWidget):
|
||||
"""ExFileSelectBox - MS Windows style file select box.
|
||||
It provides an convenient method for the user to select files.
|
||||
It provides a convenient method for the user to select files.
|
||||
|
||||
Subwidget Class
|
||||
--------- -----
|
||||
|
|
@ -760,7 +760,7 @@ class DirSelectDialog(TixWidget):
|
|||
# Should inherit from a Dialog class
|
||||
class ExFileSelectDialog(TixWidget):
|
||||
"""ExFileSelectDialog - MS Windows style file select dialog.
|
||||
It provides an convenient method for the user to select files.
|
||||
It provides a convenient method for the user to select files.
|
||||
|
||||
Subwidgets Class
|
||||
---------- -----
|
||||
|
|
|
|||
|
|
@ -1478,7 +1478,7 @@ class LabeledScale(Frame):
|
|||
can be accessed through instance.label"""
|
||||
|
||||
def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
|
||||
"""Construct an horizontal LabeledScale with parent master, a
|
||||
"""Construct a horizontal LabeledScale with parent master, a
|
||||
variable to be associated with the Ttk Scale widget and its range.
|
||||
If variable is not specified, a tkinter.IntVar is created.
|
||||
|
||||
|
|
|
|||
|
|
@ -1446,7 +1446,7 @@ class ServerProxy:
|
|||
# magic method dispatcher
|
||||
return _Method(self.__request, name)
|
||||
|
||||
# note: to call a remote object with an non-standard name, use
|
||||
# note: to call a remote object with a non-standard name, use
|
||||
# result getattr(server, "strange-python-name")(args)
|
||||
|
||||
def __call__(self, attr):
|
||||
|
|
|
|||
|
|
@ -89,9 +89,10 @@ def create_archive(source, target=None, interpreter=None, main=None):
|
|||
The created application archive will have a shebang line specifying
|
||||
that it should run with INTERPRETER (there will be no shebang line if
|
||||
INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
|
||||
not specified, an existing __main__.py will be used). It is an to specify
|
||||
MAIN for anything other than a directory source with no __main__.py, and it
|
||||
is an error to omit MAIN if the directory has no __main__.py.
|
||||
not specified, an existing __main__.py will be used). It is an error
|
||||
to specify MAIN for anything other than a directory source with no
|
||||
__main__.py, and it is an error to omit MAIN if the directory has no
|
||||
__main__.py.
|
||||
"""
|
||||
# Are we copying an existing archive?
|
||||
source_is_file = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue