##// END OF EJS Templates
typing: minor tweaks to allow updating to pytype 2022.11.18
Matt Harbison -
r50543:9be765b8 default
parent child Browse files
Show More
@@ -1938,7 +1938,12 b' def writebundle('
1938 1938 raise error.Abort(
1939 1939 _(b'old bundle types only supports v1 changegroups')
1940 1940 )
1941
1942 # HG20 is the case without 2 values to unpack, but is handled above.
1943 # pytype: disable=bad-unpacking
1941 1944 header, comp = bundletypes[bundletype]
1945 # pytype: enable=bad-unpacking
1946
1942 1947 if comp not in util.compengines.supportedbundletypes:
1943 1948 raise error.Abort(_(b'unknown stream compression type: %s') % comp)
1944 1949 compengine = util.compengines.forbundletype(comp)
@@ -5,6 +5,10 b''
5 5
6 6 import collections
7 7
8 from typing import (
9 cast,
10 )
11
8 12 from .i18n import _
9 13
10 14 from .thirdparty import attr
@@ -247,7 +251,7 b' def parsebundlespec(repo, spec, strict=T'
247 251 # required to apply it. If we see this metadata, compare against what the
248 252 # repo supports and error if the bundle isn't compatible.
249 253 if version == b'packed1' and b'requirements' in params:
250 requirements = set(params[b'requirements'].split(b','))
254 requirements = set(cast(bytes, params[b'requirements']).split(b','))
251 255 missingreqs = requirements - requirementsmod.STREAM_FIXED_REQUIREMENTS
252 256 if missingreqs:
253 257 raise error.UnsupportedBundleSpecification(
@@ -723,11 +723,15 b' def escapestr(s: bytes) -> bytes:'
723 723 s = bytes(s)
724 724 # call underlying function of s.encode('string_escape') directly for
725 725 # Python 3 compatibility
726 # pytype: disable=bad-return-type
726 727 return codecs.escape_encode(s)[0] # pytype: disable=module-attr
728 # pytype: enable=bad-return-type
727 729
728 730
729 731 def unescapestr(s: bytes) -> bytes:
732 # pytype: disable=bad-return-type
730 733 return codecs.escape_decode(s)[0] # pytype: disable=module-attr
734 # pytype: enable=bad-return-type
731 735
732 736
733 737 def forcebytestr(obj):
General Comments 0
You need to be logged in to leave comments. Login now