changeset 52889:9a8815128679

typing: add type hints to the `mercurial.util.transactional` class
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 08 Feb 2025 00:14:20 -0500
parents 7a6fc0e2a89a
children 7ca9c05ec335
files mercurial/util.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Dec 20 19:32:02 2024 -0500
+++ b/mercurial/util.py	Sat Feb 08 00:14:20 2025 -0500
@@ -1428,20 +1428,20 @@
     """Base class for making a transactional type into a context manager."""
 
     @abc.abstractmethod
-    def close(self):
+    def close(self) -> None:
         """Successfully closes the transaction."""
 
     @abc.abstractmethod
-    def release(self):
+    def release(self) -> None:
         """Marks the end of the transaction.
 
         If the transaction has not been closed, it will be aborted.
         """
 
-    def __enter__(self):
+    def __enter__(self) -> Self:
         return self
 
-    def __exit__(self, exc_type, exc_val, exc_tb):
+    def __exit__(self, exc_type, exc_val, exc_tb) -> None:
         try:
             if exc_type is None:
                 self.close()