phabricator: correct the default value of `phabhunk.corpus`
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 23 Jul 2024 19:01:16 -0400
changeset 51726 587153c96fe3
parent 51725 bbe59cc5d2e1
child 51727 a65c2dddbf5d
phabricator: correct the default value of `phabhunk.corpus` There's only one caller to this constructor (which does provide this argument), and no direct assignments, so there's no runtime bug here. However, when pytype is tricked into using the standard `attr` package instead of the vendored version, it flags this because bytes is passed to the one constructor invocation. Tricking pytype into using the standard package will generate many more type hints, noteably around `@attr.s` decorated things.
hgext/phabricator.py
--- a/hgext/phabricator.py	Mon Jul 22 18:20:29 2024 +0200
+++ b/hgext/phabricator.py	Tue Jul 23 19:01:16 2024 -0400
@@ -698,7 +698,7 @@
     oldLength = attr.ib(default=0)  # camelcase-required
     newOffset = attr.ib(default=0)  # camelcase-required
     newLength = attr.ib(default=0)  # camelcase-required
-    corpus = attr.ib(default='')
+    corpus = attr.ib(default=b'')
     # These get added to the phabchange's equivalents
     addLines = attr.ib(default=0)  # camelcase-required
     delLines = attr.ib(default=0)  # camelcase-required