Show More
@@ -193,7 +193,7 class ipeercapabilities(Protocol): | |||
|
193 | 193 | """Peer sub-interface related to capabilities.""" |
|
194 | 194 | |
|
195 | 195 | @abc.abstractmethod |
|
196 | def capable(self, name): | |
|
196 | def capable(self, name: bytes) -> bool | bytes: | |
|
197 | 197 | """Determine support for a named capability. |
|
198 | 198 | |
|
199 | 199 | Returns ``False`` if capability not supported. |
@@ -205,7 +205,7 class ipeercapabilities(Protocol): | |||
|
205 | 205 | """ |
|
206 | 206 | |
|
207 | 207 | @abc.abstractmethod |
|
208 | def requirecap(self, name, purpose): | |
|
208 | def requirecap(self, name: bytes, purpose: bytes) -> None: | |
|
209 | 209 | """Require a capability to be present. |
|
210 | 210 | |
|
211 | 211 | Raises a ``CapabilityError`` if the capability isn't present. |
@@ -457,12 +457,19 class peer(_ipeerconnection, ipeercapabi | |||
|
457 | 457 | """ |
|
458 | 458 | |
|
459 | 459 | limitedarguments: bool = False |
|
460 | ||
|
461 | def __init__(self, ui, path=None, remotehidden=False): | |
|
460 | path: urlutil.path | None | |
|
461 | ui: Ui | |
|
462 | ||
|
463 | def __init__( | |
|
464 | self, | |
|
465 | ui: Ui, | |
|
466 | path: urlutil.path | None = None, | |
|
467 | remotehidden: bool = False, | |
|
468 | ) -> None: | |
|
462 | 469 | self.ui = ui |
|
463 | 470 | self.path = path |
|
464 | 471 | |
|
465 | def capable(self, name): | |
|
472 | def capable(self, name: bytes) -> bool | bytes: | |
|
466 | 473 | # TODO: this class should maybe subclass ipeercommands too, otherwise it |
|
467 | 474 | # is assuming whatever uses this as a mixin also has this interface. |
|
468 | 475 | caps = self.capabilities() # pytype: disable=attribute-error |
@@ -476,7 +483,7 class peer(_ipeerconnection, ipeercapabi | |||
|
476 | 483 | |
|
477 | 484 | return False |
|
478 | 485 | |
|
479 | def requirecap(self, name, purpose): | |
|
486 | def requirecap(self, name: bytes, purpose: bytes) -> None: | |
|
480 | 487 | if self.capable(name): |
|
481 | 488 | return |
|
482 | 489 |
General Comments 0
You need to be logged in to leave comments.
Login now