8000 [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) · python/cpython@8c1e1da · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c1e1da

Browse files
[3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 8f943ca) Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
1 parent c800e39 commit 8c1e1da

29 files changed

+35
-33
lines changed

Doc/library/cgi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ To get at submitted form data, use the :class:`FieldStorage` class. If the form
8989
contains non-ASCII characters, use the *encoding* keyword parameter set to the
9090
value of the encoding defined for the document. It is usually contained in the
9191
META tag in the HEAD section of the HTML document or by the
92-
:mailheader:`Content-Type` header). This reads the form contents from the
92+
:mailheader:`Content-Type` header. This reads the form contents from the
9393
standard input or the environment (depending on the value of various
9494
environment variables set according to the CGI standard). Since it may consume
9595
standard input, it should be instantiated only once.

Doc/library/logging.config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in
168168
:func:`listen` socket and sending a configuration which runs whatever
169169
code the attacker wants to have executed in the victim's process. This is
170170
especially easy to do if the default port is used, but not hard even if a
171-
different port is used). To avoid the risk of this happening, use the
171+
different port is used. To avoid the risk of this happening, use the
172172
``verify`` argument to :func:`listen` to prevent unrecognised
173173
configurations from being applied.
174174

Doc/library/urllib.request.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ OpenerDirector Objects
655655
optional *timeout* parameter specifies a timeout in seconds for blocking
656656
operations like the connection attempt (if not specified, the global default
657657
timeout setting will be used). The timeout feature actually works only for
658-
HTTP, HTTPS and FTP connections).
658+
HTTP, HTTPS and FTP connections.
659659

660660

661661
.. method:: OpenerDirector.error(proto, *args)

Doc/reference/compound_stmts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ subject value:
10551055
patterns using the :data:`~object.__match_args__` attribute on the class
10561056
``name_or_attr`` before matching:
10571057

1058-
I. The equivalent of ``getattr(cls, "__match_args__", ()))`` is called.
1058+
I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called.
10591059

10601060
* If this raises an exception, the exception bubbles up.
10611061

Include/cpython/unicodeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ enum PyUnicode_Kind {
416416

417417

418418
/* Fast check to determine whether an object is ready. Equivalent to
419-
PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */
419+
PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any */
420420

421421
#define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
422422

Include/internal/pycore_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ _PyObject_IS_GC(PyObject *obj)
170170
// Fast inlined version of PyType_IS_GC()
171171
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
172172

173-
// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL)));
173+
// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL));
174174
extern int _Py_CheckSlotResult(
175175
PyObject *obj,
176176
const char *slot_name,

Lib/_osx_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def customize_compiler(_config_vars):
481481
482482
This customization is performed when the first
483483
extension module build is requested
484-
in distutils.sysconfig.customize_compiler).
484+
in distutils.sysconfig.customize_compiler.
485485
"""
486486

487487
# Find a compiler to use for extension module builds

Lib/distutils/command/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def check_metadata(self):
8383
name, version, URL
8484
8585
Recommended fields:
86-
(author and author_email) or (maintainer and maintainer_email))
86+
(author and author_email) or (maintainer and maintainer_email)
8787
8888
Warns if any are missing.
8989
"""

Lib/distutils/msvc9compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ def manifest_get_embed_info(self, target_desc, ld_args):
673673
# If a manifest should be embedded, return a tuple of
674674
# (manifest_filename, resource_id). Returns None if no manifest
675675
# should be embedded. See http://bugs.python.org/issue7833 for why
676-
# we want to avoid any manifest for extension modules if we can)
676+
# we want to avoid any manifest for extension modules if we can.
677677
for arg in ld_args:
678678
if arg.startswith("/MANIFESTFILE:"):
679679
temp_manifest = arg.split(":", 1)[1]

Lib/graphlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, node):
1717
self.npredecessors = 0
1818

1919
# List of successor nodes. The list can contain duplicated elements as
20-
# long as they're all reflected in the successor's npredecessors attribute).
20+
# long as they're all reflected in the successor's npredecessors attribute.
2121
self.successors = []
2222

2323

Lib/idlelib/idle_test/test_config_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Coverage is effectively 100%. Tkinter dialog is mocked, Mac-only line
44
may be skipped, and dummy function in bind test should not be called.
5-
Not tested: exit with 'self.advanced or self.keys_ok(keys)) ...' False.
5+
Not tested: exit with 'self.advanced or self.keys_ok(keys) ...' False.
66
"""
77

88
from idlelib import config_key

Lib/idlelib/idle_test/test_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test query, coverage 93%).
1+
"""Test query, coverage 93%.
22
33
Non-gui tests for Query, SectionName, ModuleName, and HelpSource use
44
dummy versions that extract the non-gui methods and add other needed

Lib/msilib/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@
664664
('Class','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',),
665665
('Class','Context','N',None, None, None, None, 'Identifier',None, 'The numeric server context for this server. CLSCTX_xxxx',),
666666
('Class','DefInprocHandler','Y',None, None, None, None, 'Filename','1;2;3','Optional default inproc handler. Only optionally provided if Context=CLSCTX_LOCAL_SERVER. Typically "ole32.dll" or "mapi32.dll"',),
667-
('Class','FileTypeMask','Y',None, None, None, None, 'Text',None, 'Optional string containing information for the HKCRthis CLSID) key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',),
667+
('Class','FileTypeMask','Y',None, None, None, None, 'Text',None, 'Optional string containing information for the HKCRthis CLSID key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',),
668668
('Class','Icon_','Y',None, None, 'Icon',1,'Identifier',None, 'Optional foreign key into the Icon Table, specifying the icon file associated with this CLSID. Will be written under the DefaultIcon key.',),
669669
('Class','IconIndex','Y',-32767,32767,None, None, None, None, 'Optional icon index.',),
670670
('Class','ProgId_Default','Y',None, None, 'ProgId',1,'Text',None, 'Optional ProgId associated with this CLSID.',),

Lib/pkgutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def resolve_name(name):
671671
ValueError - if `name` isn't in a recognised format
672672
ImportError - if an import failed when it shouldn't have
673673
AttributeError - if a failure occurred when traversing the object hierarchy
674-
within the imported package to get to the desired object)
674+
within the imported package to get to the desired object.
675675
"""
676676
global _NAME_PATTERN
677677
if _NAME_PATTERN is None:

Lib/pydoc_data/topics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3417,7 +3417,7 @@
34173417
'class\n'
34183418
' "name_or_attr" before matching:\n'
34193419
'\n'
3420-
' I. The equivalent of "getattr(cls, "__match_args__", ()))" '
3420+
' I. The equivalent of "getattr(cls, "__match_args__", ())" '
34213421
'is\n'
34223422
' called.\n'
34233423
'\n'

Lib/test/support/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ def dec(*args, **kwargs):
390390
# A constant likely larger than the underlying OS socket buffer size, to make
391391
# writes blocking.
392392
# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
393-
# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
394-
# for a discussion of this number).
393+
# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
394+
# for a discussion of this number.
395395
SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
396396

397397
# decorator for skipping tests on non-IEEE 754 platforms

Lib/test/test_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_common_format(self):
249249
# base marker shouldn't change the size
250250
testcommon("%0#35.33o", big, "0o012345670123456701234567012345670")
251251

252-
# Some small ints, in both Python int and flavors).
252+
# Some small ints, in both Python int and flavors.
253253
testcommon("%d", 42, "42")
254254
testcommon("%d", -42, "-42")
255255
testcommon("%d", 42.0, "42")

Lib/test/test_importlib/source/test_source_encoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EncodingTest:
2323
2424
PEP 263 specifies how that can change on a per-file basis. Either the first
2525
or second line can contain the encoding line [encoding first line]
26-
encoding second line]. If the file has the BOM marker it is considered UTF-8
26+
[encoding second line]. If the file has the BOM marker it is considered UTF-8
2727
implicitly [BOM]. If any encoding is specified it must be UTF-8, else it is
2828
an error [BOM and utf-8][BOM conflict].
2929

Lib/test/test_winreg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
("Raw Data", b"binary\x00data", REG_BINARY),
4646
("Big String", "x"*(2**14-1), REG_SZ),
4747
("Big Binary", b"x"*(2**14), REG_BINARY),
48-
# Two and three kanjis, meaning: "Japan" and "Japanese")
48+
# Two and three kanjis, meaning: "Japan" and "Japanese".
4949
("Japanese 日本", "日本語", REG_SZ),
5050
]
5151

Misc/NEWS.d/3.8.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ Make :func:`asyncio.create_subprocess_exec` accept path-like arguments.
568568
.. section: Library
569569
570570
Change default *max_workers* of ``ThreadPoolExecutor`` from ``cpu_count() *
571-
5`` to ``min(32, cpu_count() + 4))``. Previous value was unreasonably large
571+
5`` to ``min(32, cpu_count() + 4)``. Previous value was unreasonably large
572572
on many cores machines.
573573

574574
..
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
The ncurses function extended_color_content was introduced in 2017.
2-
https://invisible-island.net/ncurses/NEWS.html#index-t20170401) The
1+
The ncurses function extended_color_content was introduced in 2017
2+
3+
(https://invisible-island.net/ncurses/NEWS.html#index-t20170401). The
4+
35
ncurses-devel package in CentOS 7 had a older version ncurses resulted in
46
compilation error. For compiling ncurses with extended color support, we
57
verify the version of the ncurses library >= 20170401.

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ new_time_ex(int hour, int minute, int second, int usecond,
10131013
* true. Passing false is a speed optimization, if you know for sure
10141014
* that seconds and microseconds are already in their proper ranges. In any
10151015
* case, raises OverflowError and returns NULL if the normalized days is out
1016-
* of range).
1016+
* of range.
10171017
*/
10181018
static PyObject *
10191019
new_delta_ex(int days, int seconds, int microseconds, int normalize,

Modules/_math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ _Py_acosh(double x)
9090
* asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
9191
* we have
9292
* asinh(x) := x if 1+x*x=1,
93-
* := sign(x)*(log(x)+ln2)) for large |x|, else
93+
* := sign(x)*(log(x)+ln2) for large |x|, else
9494
* := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
9595
* := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
9696
*/

Modules/arraymodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,12 +1678,12 @@ array.array.frombytes
16781678
buffer: Py_buffer
16791679
/
16801680
1681-
Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).
1681+
Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.
16821682
[clinic start generated code]*/
16831683

16841684
static PyObject *
16851685
array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer)
1686-
/*[clinic end generated code: output=d9842c8f7510a516 input=2bbf2b53ebfcc988]*/
1686+
/*[clinic end generated code: output=d9842c8f7510a516 input=378db226dfac949e]*/
16871687
{
16881688
return frombytes(self, buffer);
16891689
}

Modules/clinic/arraymodule.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/zlibmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ PyDoc_STRVAR(zlib_module_documentation,
15041504
"compressobj([level[, ...]]) -- Return a compressor object.\n"
15051505
"crc32(string[, start]) -- Compute a CRC-32 checksum.\n"
15061506
"decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n"
1507-
"decompressobj([wbits[, zdict]]]) -- Return a decompressor object.\n"
1507+
"decompressobj([wbits[, zdict]]) -- Return a decompressor object.\n"
15081508
"\n"
15091509
"'wbits' is window buffer size and container format.\n"
15101510
"Compressor objects support compress() and flush() methods; decompressor\n"

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11023,7 +11023,7 @@ replace(PyObject *self, PyObject *str1,
1102311023
release1 = 1;
1102411024
}
1102511025
/* new_size = PyUnicode_GET_LENGTH(self) + n * (PyUnicode_GET_LENGTH(str2) -
11026-
PyUnicode_GET_LENGTH(str1))); */
11026+
PyUnicode_GET_LENGTH(str1)); */
1102711027
if (len1 < len2 && len2 - len1 > (PY_SSIZE_T_MAX - slen) / n) {
1102811028
PyErr_SetString(PyExc_OverflowError,
1102911029
"replace string is too long");

PC/getpathp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- If we DO have a Python Home: The relevant sub-directories (Lib,
3030
DLLs, etc) are based on the Python Home
3131
- If we DO NOT have a Python Home, the core Python Path is
32-
loaded from the registry. This is the main PythonPath key,
32+
loaded from the registry. (This is the main PythonPath key,
3333
and both HKLM and HKCU are combined to form the path)
3434
3535
* Iff - we can not locate the Python Home, have not had a PYTHONPATH

Tools/stringbench/stringbench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def join_alphabet_list_five(STR):
730730
for x in _RANGE_1000:
731731
sep_join(s2)
732732

733-
@bench('"A".join(["Bob"]*100))',
733+
@bench('"A".join(["Bob"]*100)',
734734
"join list of 100 words, with 1 character sep", 1000)
735735
def join_100_words_single(STR):
736736
sep = STR("A")

0 commit comments

Comments
 (0)
0