##// END OF EJS Templates
typing: add a few type hints to `mercurial/revlog.py`...
Matt Harbison -
r52570:df6ce326 default
parent child Browse files
Show More
@@ -23,6 +23,11 b' import struct'
23 23 import weakref
24 24 import zlib
25 25
26 from typing import (
27 Optional,
28 Tuple,
29 )
30
26 31 # import stuff from node for others to import from revlog
27 32 from .node import (
28 33 bin,
@@ -558,7 +563,7 b' class _InnerRevlog:'
558 563 c = self._get_decompressor(t)
559 564 return c.decompress
560 565
561 def _get_decompressor(self, t):
566 def _get_decompressor(self, t: bytes):
562 567 try:
563 568 compressor = self._decompressors[t]
564 569 except KeyError:
@@ -574,7 +579,7 b' class _InnerRevlog:'
574 579 )
575 580 return compressor
576 581
577 def compress(self, data):
582 def compress(self, data: bytes) -> Tuple[bytes, bytes]:
578 583 """Generate a possibly-compressed representation of data."""
579 584 if not data:
580 585 return b'', data
@@ -589,7 +594,7 b' class _InnerRevlog:'
589 594 return b'', data
590 595 return b'u', data
591 596
592 def decompress(self, data):
597 def decompress(self, data: bytes):
593 598 """Decompress a revlog chunk.
594 599
595 600 The chunk is expected to begin with a header identifying the
@@ -1296,6 +1301,8 b' class revlog:'
1296 1301 features = FEATURES_BY_VERSION[_format_version]
1297 1302 return features[b'inline'](_format_flags)
1298 1303
1304 _docket_file: Optional[bytes]
1305
1299 1306 def __init__(
1300 1307 self,
1301 1308 opener,
@@ -3081,7 +3088,7 b' class revlog:'
3081 3088 sidedata=sidedata,
3082 3089 )
3083 3090
3084 def compress(self, data):
3091 def compress(self, data: bytes) -> Tuple[bytes, bytes]:
3085 3092 return self._inner.compress(data)
3086 3093
3087 3094 def decompress(self, data):
General Comments 0
You need to be logged in to leave comments. Login now