blob: df48fc5d68867a8fff7f5960c468a2cceb6c5f01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# pylint: disable=missing-docstring
import typing
class Hasher(typing.Protocol):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes):
...
def digest(self) -> bytes:
...
Generic = typing.TypeVar("Generic")
class HasherGeneric(typing.Protocol[Generic]):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes):
...
def digest(self) -> bytes:
...
class Protocol: #pylint:disable=too-few-public-methods
pass
class HasherFake(Protocol):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes): # [no-self-use, unused-argument]
...
def digest(self) -> bytes: # [no-self-use]
...
|