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