bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)

diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index ec921d7..90a3f4b 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -1140,7 +1140,7 @@
     class LRU(OrderedDict):
         'Limit size, evicting the least recently looked-up key when full'
 
-        def __init__(self, maxsize=128, *args, **kwds):
+        def __init__(self, maxsize=128, /, *args, **kwds):
             self.maxsize = maxsize
             super().__init__(*args, **kwds)
 
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 017a87a..73b24e5 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -637,7 +637,7 @@
    from contextlib import ExitStack
 
    class Callback(ExitStack):
-       def __init__(self, callback, *args, **kwds):
+       def __init__(self, callback, /, *args, **kwds):
            super(Callback, self).__init__()
            self.callback(callback, *args, **kwds)
 
diff --git a/Doc/library/email.headerregistry.rst b/Doc/library/email.headerregistry.rst
index ce283c6..c3ce90c 100644
--- a/Doc/library/email.headerregistry.rst
+++ b/Doc/library/email.headerregistry.rst
@@ -107,7 +107,7 @@
    method if it wishes to set additional attributes beyond those provided by
    ``BaseHeader`` itself.  Such an ``init`` method should look like this::
 
-       def init(self, *args, **kw):
+       def init(self, /, *args, **kw):
            self._myattr = kw.pop('myattr')
            super().init(*args, **kw)
 
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 8b8b1f8..654a3ef 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -221,7 +221,7 @@
       Returning NotImplemented from the underlying comparison function for
       unrecognised types is now supported.
 
-.. function:: partial(func, *args, **keywords)
+.. function:: partial(func, /, *args, **keywords)
 
    Return a new :ref:`partial object<partial-objects>` which when called
    will behave like *func* called with the positional arguments *args*
@@ -230,7 +230,7 @@
    supplied, they extend and override *keywords*.
    Roughly equivalent to::
 
-      def partial(func, *args, **keywords):
+      def partial(func, /, *args, **keywords):
           def newfunc(*fargs, **fkeywords):
               newkeywords = {**keywords, **fkeywords}
               return func(*args, *fargs, **newkeywords)
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 1cc503a..2a71201 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -1022,7 +1022,7 @@
    metatype is in use, cls will be the first element of the tuple.
 
 
-.. function:: getcallargs(func, *args, **kwds)
+.. function:: getcallargs(func, /, *args, **kwds)
 
    Bind the *args* and *kwds* to the argument names of the Python function or
    method *func*, as if it was called with them. For bound methods, bind also the
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index 5d0ea7d..fa02bde 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -339,7 +339,7 @@
       [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
 
 
-.. function:: methodcaller(name[, args...])
+.. function:: methodcaller(name, /, *args, **kwargs)
 
    Return a callable object that calls the method *name* on its operand.  If
    additional arguments and/or keyword arguments are given, they will be given
@@ -352,7 +352,7 @@
 
    Equivalent to::
 
-      def methodcaller(name, *args, **kwargs):
+      def methodcaller(name, /, *args, **kwargs):
           def caller(obj):
               return getattr(obj, name)(*args, **kwargs)
           return caller
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index c2f6522..288dde6 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -88,7 +88,7 @@
 
    The :class:`Formatter` class has the following public methods:
 
-   .. method:: format(format_string, *args, **kwargs)
+   .. method:: format(format_string, /, *args, **kwargs)
 
       The primary API method.  It takes a format string and
       an arbitrary set of positional and keyword arguments.
@@ -720,7 +720,7 @@
    The constructor takes a single argument which is the template string.
 
 
-   .. method:: substitute(mapping, **kwds)
+   .. method:: substitute(mapping={}, /, **kwds)
 
       Performs the template substitution, returning a new string.  *mapping* is
       any dictionary-like object with keys that match the placeholders in the
@@ -729,7 +729,7 @@
       and there are duplicates, the placeholders from *kwds* take precedence.
 
 
-   .. method:: safe_substitute(mapping, **kwds)
+   .. method:: safe_substitute(mapping={}, /, **kwds)
 
       Like :meth:`substitute`, except that if placeholders are missing from
       *mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 07c3a2e..e629c29 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -327,7 +327,7 @@
    The type is roughly equivalent to the following code::
 
        class SimpleNamespace:
-           def __init__(self, **kwargs):
+           def __init__(self, /, **kwargs):
                self.__dict__.update(kwargs)
 
            def __repr__(self):
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst
index 16690f3..811f0fb 100644
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -848,7 +848,7 @@
 
     >>> from copy import deepcopy
     >>> class CopyingMock(MagicMock):
-    ...     def __call__(self, *args, **kwargs):
+    ...     def __call__(self, /, *args, **kwargs):
     ...         args = deepcopy(args)
     ...         kwargs = deepcopy(kwargs)
     ...         return super(CopyingMock, self).__call__(*args, **kwargs)
@@ -1042,7 +1042,7 @@
 onto the mock constructor:
 
     >>> class Subclass(MagicMock):
-    ...     def _get_child_mock(self, **kwargs):
+    ...     def _get_child_mock(self, /, **kwargs):
     ...         return MagicMock(**kwargs)
     ...
     >>> mymock = Subclass()
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 54a9f2c..5ec4b40 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1456,7 +1456,7 @@
 
       .. versionadded:: 3.1
 
-   .. classmethod:: addClassCleanup(function, *args, **kwargs)
+   .. classmethod:: addClassCleanup(function, /, *args, **kwargs)
 
       Add a function to be called after :meth:`tearDownClass` to cleanup
       resources used during the test class. Functions will be called in reverse
@@ -2313,7 +2313,7 @@
 ``addModuleCleanup``:
 
 
-.. function:: addModuleCleanup(function, *args, **kwargs)
+.. function:: addModuleCleanup(function, /, *args, **kwargs)
 
    Add a function to be called after :func:`tearDownModule` to cleanup
    resources used during the test class. Functions will be called in reverse
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index 80a908b..a28d710 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -396,7 +396,7 @@
    import weakref
 
    class ExtendedRef(weakref.ref):
-       def __init__(self, ob, callback=None, **annotations):
+       def __init__(self, ob, callback=None, /, **annotations):
            super(ExtendedRef, self).__init__(ob, callback)
            self.__counter = 0
            for k, v in annotations.items():
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 76d0093..bc7c9ef 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -941,8 +941,7 @@
     :meth:`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`,
     :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` and
     :func:`curses.wrapper`.
-  - *function* in :func:`unittest.addModuleCleanup` and
-    :meth:`unittest.TestCase.addCleanup`.
+  - *function* in :meth:`unittest.TestCase.addCleanup`.
   - *fn* in the :meth:`~concurrent.futures.Executor.submit` method of
     :class:`concurrent.futures.ThreadPoolExecutor` and
     :class:`concurrent.futures.ProcessPoolExecutor`.