]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[codemod] Fix non-matching bracket pairs (GH-28473)
authorMohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
Tue, 21 Sep 2021 23:09:00 +0000 (02:09 +0300)
committerGitHub <noreply@github.com>
Tue, 21 Sep 2021 23:09:00 +0000 (01:09 +0200)
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>
29 files changed:
Doc/library/cgi.rst
Doc/library/logging.config.rst
Doc/library/urllib.request.rst
Doc/reference/compound_stmts.rst
Include/cpython/unicodeobject.h
Include/internal/pycore_object.h
Lib/_osx_support.py
Lib/distutils/command/check.py
Lib/distutils/msvc9compiler.py
Lib/graphlib.py
Lib/idlelib/idle_test/test_config_key.py
Lib/idlelib/idle_test/test_query.py
Lib/msilib/schema.py
Lib/pkgutil.py
Lib/pydoc_data/topics.py
Lib/test/support/__init__.py
Lib/test/test_format.py
Lib/test/test_importlib/source/test_source_encoding.py
Lib/test/test_winreg.py
Misc/NEWS.d/3.8.0b1.rst
Misc/NEWS.d/next/Build/2021-09-09-16-45-26.bpo-45067.mFmY92.rst
Modules/_datetimemodule.c
Modules/_math.c
Modules/arraymodule.c
Modules/clinic/arraymodule.c.h
Modules/zlibmodule.c
Objects/unicodeobject.c
PC/getpathp.c
Tools/stringbench/stringbench.py

index 1494fa7d52407a8f6263ba75a4217882c1420d14..c151f04dfb8d01b06b7b1ad169f2b1e8fd22b22c 100644 (file)
@@ -89,7 +89,7 @@ To get at submitted form data, use the :class:`FieldStorage` class. If the form
 contains non-ASCII characters, use the *encoding* keyword parameter set to the
 value of the encoding defined for the document. It is usually contained in the
 META tag in the HEAD section of the HTML document or by the
-:mailheader:`Content-Type` header).  This reads the form contents from the
+:mailheader:`Content-Type` header.  This reads the form contents from the
 standard input or the environment (depending on the value of various
 environment variables set according to the CGI standard).  Since it may consume
 standard input, it should be instantiated only once.
index d3478a94345f0ac5a9135f4dbdd9848d99012866..5a3e686802ea83adb45f6ae225e3c286d53947a9 100644 (file)
@@ -168,7 +168,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in
       :func:`listen` socket and sending a configuration which runs whatever
       code the attacker wants to have executed in the victim's process. This is
       especially easy to do if the default port is used, but not hard even if a
-      different port is used). To avoid the risk of this happening, use the
+      different port is used. To avoid the risk of this happening, use the
       ``verify`` argument to :func:`listen` to prevent unrecognised
       configurations from being applied.
 
index 130c7d694e8a6ab8aada64b641d57322ca6b9a66..dbb8c250772ed2fc3651be7ed72c76ead6eb6055 100644 (file)
@@ -655,7 +655,7 @@ OpenerDirector Objects
    optional *timeout* parameter specifies a timeout in seconds for blocking
    operations like the connection attempt (if not specified, the global default
    timeout setting will be used). The timeout feature actually works only for
-   HTTP, HTTPS and FTP connections).
+   HTTP, HTTPS and FTP connections.
 
 
 .. method:: OpenerDirector.error(proto, *args)
index 8afcadbfbcf6b069f4d80023c23b8818d70ede43..f24222f5fd9e946e65b22f2f6919d85761afdaa9 100644 (file)
@@ -1055,7 +1055,7 @@ subject value:
    patterns using the :data:`~object.__match_args__` attribute on the class
    ``name_or_attr`` before matching:
 
-   I. The equivalent of ``getattr(cls, "__match_args__", ()))`` is called.
+   I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called.
 
       * If this raises an exception, the exception bubbles up.
 
index 95b76cecd6f4f2ff44c39378c4e0c2f84b6f952b..b40e2ea1011f5c7e391d4ed1f72429c667aee0cb 100644 (file)
@@ -416,7 +416,7 @@ enum PyUnicode_Kind {
 
 
 /* Fast check to determine whether an object is ready. Equivalent to
-   PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */
+   PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any */
 
 #define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
 
index 744b41ae5d90d6f9583e6ba146c48f3faf033ed1..82dddf119a47a1c2bed1526a0164fba8982245bb 100644 (file)
@@ -168,7 +168,7 @@ _PyObject_IS_GC(PyObject *obj)
 // Fast inlined version of PyType_IS_GC()
 #define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
 
-// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL)));
+// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL));
 extern int _Py_CheckSlotResult(
     PyObject *obj,
     const char *slot_name,
index 326b36d611631410b300801e33d3eeb26af2314f..aa66c8b9f4189f8b688f26469def701b821e049c 100644 (file)
@@ -481,7 +481,7 @@ def customize_compiler(_config_vars):
 
     This customization is performed when the first
     extension module build is requested
-    in distutils.sysconfig.customize_compiler).
+    in distutils.sysconfig.customize_compiler.
     """
 
     # Find a compiler to use for extension module builds
index ada250064678ee3ddfbc29244a45ca64d527659c..73a30f3afd84a345bd2c15f48840b20584519c0f 100644 (file)
@@ -83,7 +83,7 @@ class check(Command):
             name, version, URL
 
         Recommended fields:
-            (author and author_email) or (maintainer and maintainer_email))
+            (author and author_email) or (maintainer and maintainer_email)
 
         Warns if any are missing.
         """
index 6934e964abd69b371aa4b0ad9587dea61602049f..a7976fbe3ed924efda902f221899e35147e6c5ec 100644 (file)
@@ -673,7 +673,7 @@ class MSVCCompiler(CCompiler) :
         # If a manifest should be embedded, return a tuple of
         # (manifest_filename, resource_id).  Returns None if no manifest
         # should be embedded.  See http://bugs.python.org/issue7833 for why
-        # we want to avoid any manifest for extension modules if we can)
+        # we want to avoid any manifest for extension modules if we can.
         for arg in ld_args:
             if arg.startswith("/MANIFESTFILE:"):
                 temp_manifest = arg.split(":", 1)[1]
index d0e7a4814c565dc8cd0ccba81c25fa439978c478..1c5d9a413c944d376f9a9b29f8a86fa90e5a31d5 100644 (file)
@@ -17,7 +17,7 @@ class _NodeInfo:
         self.npredecessors = 0
 
         # List of successor nodes. The list can contain duplicated elements as
-        # long as they're all reflected in the successor's npredecessors attribute).
+        # long as they're all reflected in the successor's npredecessors attribute.
         self.successors = []
 
 
index b7fe7fd6b5ec106edf705678b1e8942837bb84c9..bf66cadf57cd3c081d773fa90b6e2d30d70ad921 100644 (file)
@@ -2,7 +2,7 @@
 
 Coverage is effectively 100%.  Tkinter dialog is mocked, Mac-only line
 may be skipped, and dummy function in bind test should not be called.
-Not tested: exit with 'self.advanced or self.keys_ok(keys)) ...' False.
+Not tested: exit with 'self.advanced or self.keys_ok(keys) ...' False.
 """
 
 from idlelib import config_key
index 41905111b7a730859756a075485279ca58ced204..bb12b2b08652d54717f314849d28a8bfc8f5c3bb 100644 (file)
@@ -1,4 +1,4 @@
-"""Test query, coverage 93%).
+"""Test query, coverage 93%.
 
 Non-gui tests for Query, SectionName, ModuleName, and HelpSource use
 dummy versions that extract the non-gui methods and add other needed
index eeb3ecd27ab6583c1bae7b842eac39380b11dbcc..9f5745cfb14de223d726392ab4c021f8334706ba 100644 (file)
@@ -664,7 +664,7 @@ _Validation_records = [
 ('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.',),
 ('Class','Context','N',None, None, None, None, 'Identifier',None, 'The numeric server context for this server. CLSCTX_xxxx',),
 ('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"',),
-('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...',),
+('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...',),
 ('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.',),
 ('Class','IconIndex','Y',-32767,32767,None, None, None, None, 'Optional icon index.',),
 ('Class','ProgId_Default','Y',None, None, 'ProgId',1,'Text',None, 'Optional ProgId associated with this CLSID.',),
index 48c1479ee6ceddcbdb7bde2db314e551535e8c61..bdebfd2fc8ac329a2a2b73d82b36920a45ea2440 100644 (file)
@@ -672,7 +672,7 @@ def resolve_name(name):
     ValueError - if `name` isn't in a recognised format
     ImportError - if an import failed when it shouldn't have
     AttributeError - if a failure occurred when traversing the object hierarchy
-                     within the imported package to get to the desired object)
+                     within the imported package to get to the desired object.
     """
     global _NAME_PATTERN
     if _NAME_PATTERN is None:
index 83e1a975ec78b28d5aa903963a2c2146c46cbca9..40f7a50128619fa04e9d340656dbc39534892b0d 100644 (file)
@@ -3324,7 +3324,7 @@ topics = {'assert': 'The "assert" statement\n'
              'class\n'
              '   "name_or_attr" before matching:\n'
              '\n'
-             '   I. The equivalent of "getattr(cls, "__match_args__", ()))" '
+             '   I. The equivalent of "getattr(cls, "__match_args__", ())" '
              'is\n'
              '   called.\n'
              '\n'
index bc40bba9094963e93b2d9e2a088c350bcfaff9aa..b29f438e52cf8262d3d22424766272018cb8b26d 100644 (file)
@@ -395,8 +395,8 @@ PIPE_MAX_SIZE = 4 * 1024 * 1024 + 1
 # A constant likely larger than the underlying OS socket buffer size, to make
 # writes blocking.
 # The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
-# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
-# for a discussion of this number).
+# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF).  See issue #18643
+# for a discussion of this number.
 SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
 
 # decorator for skipping tests on non-IEEE 754 platforms
index 6679bd3d8899cd29a8d592969285fdd379250689..ae0d4f7308e2c9a17553854b03c48c1261a617bc 100644 (file)
@@ -249,7 +249,7 @@ class FormatTest(unittest.TestCase):
         # base marker shouldn't change the size
         testcommon("%0#35.33o", big, "0o012345670123456701234567012345670")
 
-        # Some small ints, in both Python int and flavors).
+        # Some small ints, in both Python int and flavors.
         testcommon("%d", 42, "42")
         testcommon("%d", -42, "-42")
         testcommon("%d", 42.0, "42")
index 980855fe1ade18df60a2e19f66badc461b98246d..c0b9b031262eb7bdf876a3c4444c095c4873f4aa 100644 (file)
@@ -23,7 +23,7 @@ class EncodingTest:
 
     PEP 263 specifies how that can change on a per-file basis. Either the first
     or second line can contain the encoding line [encoding first line]
-    encoding second line]. If the file has the BOM marker it is considered UTF-8
+    [encoding second line]. If the file has the BOM marker it is considered UTF-8
     implicitly [BOM]. If any encoding is specified it must be UTF-8, else it is
     an error [BOM and utf-8][BOM conflict].
 
index fedfbe9b447655549444cdd867ff9a666477d44b..8157c2da6efaa640d4bd73ee995ed1d36b98a2e8 100644 (file)
@@ -45,7 +45,7 @@ test_data = [
     ("Raw Data",      b"binary\x00data",                       REG_BINARY),
     ("Big String",    "x"*(2**14-1),                           REG_SZ),
     ("Big Binary",    b"x"*(2**14),                            REG_BINARY),
-    # Two and three kanjis, meaning: "Japan" and "Japanese")
+    # Two and three kanjis, meaning: "Japan" and "Japanese".
     ("Japanese 日本", "日本語", REG_SZ),
 ]
 
index 5400c07795292a75c57c62c69971c65f0de7eeb7..5285770de13186db5cdaaa0322c2f5aec23d2f97 100644 (file)
@@ -568,7 +568,7 @@ Make :func:`asyncio.create_subprocess_exec` accept path-like arguments.
 .. section: Library
 
 Change default *max_workers* of ``ThreadPoolExecutor`` from ``cpu_count() *
-5`` to ``min(32, cpu_count() + 4))``.  Previous value was unreasonably large
+5`` to ``min(32, cpu_count() + 4)``.  Previous value was unreasonably large
 on many cores machines.
 
 ..
index b64a899bd3372856ae45385c31e7fc627d3e3f4d..a89736eb33e82bd9f564fa0ff9bd2333af240f48 100644 (file)
@@ -1,5 +1,7 @@
-The ncurses function extended_color_content was introduced in 2017.\r
-https://invisible-island.net/ncurses/NEWS.html#index-t20170401) The\r
+The ncurses function extended_color_content was introduced in 2017\r
+\r
+(https://invisible-island.net/ncurses/NEWS.html#index-t20170401).  The\r
+\r
 ncurses-devel package in CentOS 7 had a older version ncurses resulted in\r
 compilation error.  For compiling ncurses with extended color support, we\r
 verify the version of the ncurses library >= 20170401.\r
index 8ef2dad37a3a05173b8413a0e5b788d1f0be400f..e54a01b44c5bad0c761c5a86c55ac3d4807ef8bc 100644 (file)
@@ -1013,7 +1013,7 @@ new_time_ex(int hour, int minute, int second, int usecond,
  * true.  Passing false is a speed optimization, if you know for sure
  * that seconds and microseconds are already in their proper ranges.  In any
  * case, raises OverflowError and returns NULL if the normalized days is out
- * of range).
+ * of range.
  */
 static PyObject *
 new_delta_ex(int days, int seconds, int microseconds, int normalize,
index 02d8f1c43c80070f01076b1ec09a1119e79e925c..68e3a2346925de8d8ecc63d3ccaaf340cdbe24e9 100644 (file)
@@ -90,7 +90,7 @@ _Py_acosh(double x)
  *              asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
  *      we have
  *      asinh(x) := x  if  1+x*x=1,
- *               := sign(x)*(log(x)+ln2)) for large |x|, else
+ *               := sign(x)*(log(x)+ln2) for large |x|, else
  *               := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
  *               := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
  */
index 9a3203c7caaa8ac9c49aee3464cfbf90d4c21b49..c9b6a92c2274918d85e6c48bb0c8287810cf19c8 100644 (file)
@@ -1678,12 +1678,12 @@ array.array.frombytes
     buffer: Py_buffer
     /
 
-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).
+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.
 [clinic start generated code]*/
 
 static PyObject *
 array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer)
-/*[clinic end generated code: output=d9842c8f7510a516 input=2bbf2b53ebfcc988]*/
+/*[clinic end generated code: output=d9842c8f7510a516 input=378db226dfac949e]*/
 {
     return frombytes(self, buffer);
 }
index d2513eb4f48cfdda915937ee205c3403f646bdfc..c46cc738de91b7ed47aef9f918f8cecf79bdb973 100644 (file)
@@ -359,7 +359,7 @@ PyDoc_STRVAR(array_array_frombytes__doc__,
 "frombytes($self, buffer, /)\n"
 "--\n"
 "\n"
-"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).");
+"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.");
 
 #define ARRAY_ARRAY_FROMBYTES_METHODDEF    \
     {"frombytes", (PyCFunction)array_array_frombytes, METH_O, array_array_frombytes__doc__},
@@ -572,4 +572,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
 
 #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=376001addedc67ee input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f130a994f98f1227 input=a9049054013a1b77]*/
index 27a6d9a9366bf739123df8249ee5501b0c394630..28fe8840fc0675f53326c7372851da9064f919cd 100644 (file)
@@ -1507,7 +1507,7 @@ PyDoc_STRVAR(zlib_module_documentation,
 "compressobj([level[, ...]]) -- Return a compressor object.\n"
 "crc32(string[, start]) -- Compute a CRC-32 checksum.\n"
 "decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n"
-"decompressobj([wbits[, zdict]]]) -- Return a decompressor object.\n"
+"decompressobj([wbits[, zdict]]) -- Return a decompressor object.\n"
 "\n"
 "'wbits' is window buffer size and container format.\n"
 "Compressor objects support compress() and flush() methods; decompressor\n"
index 9b0b8694bfdf6141ee878b435fedac49fc1977cc..f5919cf5a95cd905dcb0fa4e5051af43c0f641c7 100644 (file)
@@ -10747,7 +10747,7 @@ replace(PyObject *self, PyObject *str1,
             release1 = 1;
         }
         /* new_size = PyUnicode_GET_LENGTH(self) + n * (PyUnicode_GET_LENGTH(str2) -
-           PyUnicode_GET_LENGTH(str1))); */
+           PyUnicode_GET_LENGTH(str1)); */
         if (len1 < len2 && len2 - len1 > (PY_SSIZE_T_MAX - slen) / n) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "replace string is too long");
index 53da3a6d05faee99b72db2ea2ee2095b01e950ea..603a1eb13c4ff016c7406853ab717149965dc5d2 100644 (file)
@@ -29,7 +29,7 @@
      - If we DO have a Python Home: The relevant sub-directories (Lib,
        DLLs, etc) are based on the Python Home
      - If we DO NOT have a Python Home, the core Python Path is
-       loaded from the registry.  This is the main PythonPath key,
+       loaded from the registry.  (This is the main PythonPath key,
        and both HKLM and HKCU are combined to form the path)
 
    * Iff - we can not locate the Python Home, have not had a PYTHONPATH
index 5abc25a5723f26092134f57fa04f37d1c1d96f50..5d2b4146378626152bad6da6215aae13ac2043c8 100644 (file)
@@ -730,7 +730,7 @@ def join_alphabet_list_five(STR):
     for x in _RANGE_1000:
         sep_join(s2)
 
-@bench('"A".join(["Bob"]*100))',
+@bench('"A".join(["Bob"]*100)',
        "join list of 100 words, with 1 character sep", 1000)
 def join_100_words_single(STR):
     sep = STR("A")