changeset 49796:98e7be1ed6c5

doc: don't pass str to ui methods in check-seclevel.py
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Dec 2022 14:57:42 -0500
parents f1e820cda2f5
children 0449fb7729d7
files contrib/check-pytype.sh doc/check-seclevel.py
diffstat 2 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-pytype.sh	Sat Dec 10 14:44:46 2022 -0500
+++ b/contrib/check-pytype.sh	Sat Dec 10 14:57:42 2022 -0500
@@ -42,7 +42,7 @@
 
 # TODO: include hgext and hgext3rd
 
-pytype -V 3.7 --keep-going --jobs auto mercurial \
+pytype -V 3.7 --keep-going --jobs auto doc/check-seclevel.py mercurial \
     -x mercurial/bundlerepo.py \
     -x mercurial/context.py \
     -x mercurial/crecord.py \
--- a/doc/check-seclevel.py	Sat Dec 10 14:44:46 2022 -0500
+++ b/doc/check-seclevel.py	Sat Dec 10 14:57:42 2022 -0500
@@ -46,7 +46,7 @@
 
 
 def checkseclevel(ui, doc, name, initlevel):
-    ui.notenoi18n('checking "%s"\n' % name)
+    ui.notenoi18n(('checking "%s"\n' % name).encode('utf-8'))
     if not isinstance(doc, bytes):
         doc = doc.encode('utf-8')
     blocks, pruned = minirst.parse(doc, 0, ['verbose'])
@@ -70,14 +70,18 @@
         nextlevel = mark2level[mark]
         if curlevel < nextlevel and curlevel + 1 != nextlevel:
             ui.warnnoi18n(
-                'gap of section level at "%s" of %s\n' % (title, name)
+                ('gap of section level at "%s" of %s\n' % (title, name)).encode(
+                    'utf-8'
+                )
             )
             showavailables(ui, initlevel)
             errorcnt += 1
             continue
         ui.notenoi18n(
-            'appropriate section level for "%s %s"\n'
-            % (mark * (nextlevel * 2), title)
+            (
+                'appropriate section level for "%s %s"\n'
+                % (mark * (nextlevel * 2), title)
+            ).encode('utf-8')
         )
         curlevel = nextlevel
 
@@ -90,7 +94,9 @@
         name = k.split(b"|")[0].lstrip(b"^")
         if not entry[0].__doc__:
             ui.notenoi18n(
-                'skip checking %s: no help document\n' % (namefmt % name)
+                (
+                    'skip checking %s: no help document\n' % (namefmt % name)
+                ).encode('utf-8')
             )
             continue
         errorcnt += checkseclevel(
@@ -117,7 +123,9 @@
         mod = extensions.load(ui, name, None)
         if not mod.__doc__:
             ui.notenoi18n(
-                'skip checking %s extension: no help document\n' % name
+                (
+                    'skip checking %s extension: no help document\n' % name
+                ).encode('utf-8')
             )
             continue
         errorcnt += checkseclevel(
@@ -144,7 +152,9 @@
             doc = fp.read()
 
     ui.notenoi18n(
-        'checking input from %s with initlevel %d\n' % (filename, initlevel)
+        (
+            'checking input from %s with initlevel %d\n' % (filename, initlevel)
+        ).encode('utf-8')
     )
     return checkseclevel(ui, doc, 'input from %s' % filename, initlevel)