Skip to content

Conversation

@AlexWaygood
Copy link
Member

This edit means that the docstrings inserted by the codemod look closer to what they look like upstream in the CPython source code. We should see a diff like this following the next typeshed sync, after we update the pinned commit of docstring-adder in Ruff to one that includes this PR:

diff --git a/stdlib/__future__.pyi b/stdlib/__future__.pyi
index 76ecfca2c..ce4442d92 100644
--- a/stdlib/__future__.pyi
+++ b/stdlib/__future__.pyi
@@ -55,15 +55,13 @@ _VersionInfo: TypeAlias = tuple[int, int, int, str, int]
 class _Feature:
     def __init__(self, optionalRelease: _VersionInfo, mandatoryRelease: _VersionInfo | None, compiler_flag: int) -> None: ...
     def getOptionalRelease(self) -> _VersionInfo:
-        """
-        Return first release in which this feature was recognized.
+        """Return first release in which this feature was recognized.
 
         This is a 5-tuple, of the same form as sys.version_info.
         """
 
     def getMandatoryRelease(self) -> _VersionInfo | None:
-        """
-        Return release in which this feature will become mandatory.
+        """Return release in which this feature will become mandatory.
 
         This is a 5-tuple, of the same form as sys.version_info, or, if
         the feature was dropped, or the release date is undetermined, is None.
diff --git a/stdlib/_asyncio.pyi b/stdlib/_asyncio.pyi
index 3a3721dad..ef0f8e0d7 100644
--- a/stdlib/_asyncio.pyi
+++ b/stdlib/_asyncio.pyi
@@ -15,8 +15,7 @@ _T_co = TypeVar("_T_co", covariant=True)
 _TaskYieldType: TypeAlias = Future[object] | None
 
 class Future(Awaitable[_T]):
-    """
-    This class is *almost* compatible with concurrent.futures.Future.
+    """This class is *almost* compatible with concurrent.futures.Future.
 
     Differences:
 
@@ -41,20 +40,15 @@ class Future(Awaitable[_T]):
     _asyncio_future_blocking: bool  # is a part of duck-typing contract for `Future`
     def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
     def __del__(self) -> None:
-        """
-        Called when the instance is about to be destroyed.
-        """
+        """Called when the instance is about to be destroyed."""
 
     def get_loop(self) -> AbstractEventLoop:
-        """
-        Return the event loop the Future is bound to.
-        """
+        """Return the event loop the Future is bound to."""
 
     @property
     def _callbacks(self) -> list[tuple[Callable[[Self], Any], Context]]: ...
     def add_done_callback(self, fn: Callable[[Self], object], /, *, context: Context | None = None) -> None:
-        """
-        Add a callback to be run when the future becomes done.
+        """Add a callback to be run when the future becomes done.
 
         The callback is called with a single argument - the future object. If
         the future is already done when this is called, the callback is
@@ -62,8 +56,7 @@ class Future(Awaitable[_T]):
         """
 
     def cancel(self, msg: Any | None = None) -> bool:
-        """
-        Cancel the future and schedule callbacks.
+        """Cancel the future and schedule callbacks.
 
         If the future is already done or cancelled, return False.  Otherwise,
         change the future's state to cancelled, schedule the callbacks and

@AlexWaygood AlexWaygood merged commit 7f350b0 into main Jul 15, 2025
14 checks passed
@AlexWaygood AlexWaygood deleted the alex/fewer-added-newlines branch July 20, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants