--- a/mercurial/httppeer.py Mon Dec 16 02:41:24 2024 -0500
+++ b/mercurial/httppeer.py Mon Dec 16 03:04:44 2024 -0500
@@ -13,6 +13,7 @@
import os
import socket
import struct
+import typing
from concurrent import futures
from .i18n import _
@@ -28,6 +29,11 @@
)
from .utils import urlutil
+if typing.TYPE_CHECKING:
+ from typing import (
+ Set,
+ )
+
httplib = util.httplib
urlerr = util.urlerr
urlreq = util.urlreq
@@ -439,7 +445,7 @@
# Begin of ipeercapabilities interface.
- def capabilities(self):
+ def capabilities(self) -> Set[bytes]:
return self._caps
# End of ipeercapabilities interface.
--- a/mercurial/interfaces/repository.py Mon Dec 16 02:41:24 2024 -0500
+++ b/mercurial/interfaces/repository.py Mon Dec 16 03:04:44 2024 -0500
@@ -205,7 +205,7 @@
"""
@abc.abstractmethod
- def capabilities(self):
+ def capabilities(self) -> Set[bytes]:
"""Obtain capabilities of the peer.
Returns a set of string capabilities.
--- a/mercurial/localrepo.py Mon Dec 16 02:41:24 2024 -0500
+++ b/mercurial/localrepo.py Mon Dec 16 03:04:44 2024 -0500
@@ -20,6 +20,7 @@
from concurrent import futures
from typing import (
Optional,
+ Set,
)
from .i18n import _
@@ -341,7 +342,7 @@
# Begin of ipeercapabilities interface.
- def capabilities(self):
+ def capabilities(self) -> Set[bytes]:
return self._caps
# End of ipeercapabilities interface.
--- a/mercurial/sshpeer.py Mon Dec 16 02:41:24 2024 -0500
+++ b/mercurial/sshpeer.py Mon Dec 16 03:04:44 2024 -0500
@@ -8,6 +8,7 @@
from __future__ import annotations
import re
+import typing
import uuid
from .i18n import _
@@ -25,6 +26,11 @@
urlutil,
)
+if typing.TYPE_CHECKING:
+ from typing import (
+ Set,
+ )
+
def _serverquote(s):
"""quote a string for the remote shell ... which we assume is sh"""
@@ -441,7 +447,7 @@
# Begin of ipeercapabilities interface.
- def capabilities(self):
+ def capabilities(self) -> Set[bytes]:
return self._caps
# End of ipeercapabilities interface.
--- a/tests/test-wireproto.py Mon Dec 16 02:41:24 2024 -0500
+++ b/tests/test-wireproto.py Mon Dec 16 03:04:44 2024 -0500
@@ -1,5 +1,9 @@
import sys
+from typing import (
+ Set,
+)
+
from mercurial import (
error,
pycompat,
@@ -55,8 +59,8 @@
def close(self):
pass
- def capabilities(self):
- return [b'batch']
+ def capabilities(self) -> Set[bytes]:
+ return {b'batch'}
def _call(self, cmd, **args):
args = pycompat.byteskwargs(args)