wireprototypes: convert `baseprotocolhandler.name` to an abstract property
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 24 Oct 2024 22:37:45 -0400
changeset 52127 e7812caacc3c
parent 52126 1938d72e7a16
child 52128 fd200f5bcaea
wireprototypes: convert `baseprotocolhandler.name` to an abstract property PyCharm was flagging the subclasses where this was declared as a `@property` with Type of 'name' is incompatible with 'baseprotocolhandler' But pytype didn't complain. This seems more correct, however. Since `Protocol` is already an `abc.ABCMeta` class, we don't need to mess with the class hierarchy.
mercurial/wireprototypes.py
--- a/mercurial/wireprototypes.py	Thu Oct 24 20:50:47 2024 -0400
+++ b/mercurial/wireprototypes.py	Thu Oct 24 22:37:45 2024 -0400
@@ -5,6 +5,7 @@
 
 from __future__ import annotations
 
+import abc
 import typing
 
 from typing import (
@@ -193,11 +194,13 @@
     the request, handle response types, etc.
     """
 
-    name: bytes
-    """The name of the protocol implementation.
+    @property
+    @abc.abstractmethod
+    def name(self) -> bytes:
+        """The name of the protocol implementation.
 
-    Used for uniquely identifying the transport type.
-    """
+        Used for uniquely identifying the transport type.
+        """
 
     def getargs(self, args):
         """return the value for arguments in <args>