[Updated] D11918: pytype: stop excluding stringutil.py
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Fri Dec 17 11:10:51 UTC 2021
Closed by commit rHGdcdecec401ca: pytype: stop excluding stringutil.py (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11918?vs=31475&id=31512
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11918/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11918
AFFECTED FILES
mercurial/utils/stringutil.py
tests/test-check-pytype.t
CHANGE DETAILS
diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -38,7 +38,6 @@
mercurial/unionrepo.py # ui, svfs, unfiltered [attribute-error]
mercurial/util.py # [attribute-error], [wrong-arg-count]
mercurial/utils/procutil.py # [attribute-error], [module-attr], [bad-return-type]
-mercurial/utils/stringutil.py # [module-attr], [wrong-arg-count]
mercurial/utils/memorytop.py # not 3.6 compatible
mercurial/win32.py # [not-callable]
mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], [import-error]
@@ -80,7 +79,6 @@
> -x mercurial/ui.py \
> -x mercurial/unionrepo.py \
> -x mercurial/utils/procutil.py \
- > -x mercurial/utils/stringutil.py \
> -x mercurial/utils/memorytop.py \
> -x mercurial/win32.py \
> -x mercurial/wireprotoframing.py \
diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -264,7 +264,11 @@
q1 = rs.find(b'<', p1 + 1)
if q1 < 0:
q1 = len(rs)
+ # pytype: disable=wrong-arg-count
+ # TODO: figure out why pytype doesn't recognize the optional start
+ # arg
elif q1 > p1 + 1 and rs.startswith(b'=', q1 - 1):
+ # pytype: enable=wrong-arg-count
# backtrack for ' field=<'
q0 = rs.rfind(b' ', p1 + 1, q1 - 1)
if q0 < 0:
@@ -692,11 +696,11 @@
s = bytes(s)
# call underlying function of s.encode('string_escape') directly for
# Python 3 compatibility
- return codecs.escape_encode(s)[0]
+ return codecs.escape_encode(s)[0] # pytype: disable=module-attr
def unescapestr(s):
- return codecs.escape_decode(s)[0]
+ return codecs.escape_decode(s)[0] # pytype: disable=module-attr
def forcebytestr(obj):
To: mharbison72, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211217/0726f105/attachment-0002.html>
More information about the Mercurial-patches
mailing list