Mercurial > public > mercurial-scm > hg
comparison hgext/fastannotate/context.py @ 51710:45d5e9a0f6a6
typing: add some type hints to fastannotate that have decayed in the last year
Somewhere since 10db46e128d4, `_knownopts` decayed to `set` for unknown reasons.
Also, `annotateopts.default` changed from bytes to str. While that is correct,
I noticed that PyCharm was flagging the member fields as undefined in
`shortstr()`, so add those to keep it happy. (There are no complaints from
pytype because that module is excluded, due to the missing reference to
`linelog.copyfrom()` that I'm not sure how to fix.)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 18 Jul 2024 19:01:55 -0400 |
parents | ca7bde5dbafb |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51709:74f1bf147a6d | 51710:45d5e9a0f6a6 |
---|---|
172 'diffopts': None, | 172 'diffopts': None, |
173 'followrename': True, | 173 'followrename': True, |
174 'followmerge': True, | 174 'followmerge': True, |
175 } | 175 } |
176 | 176 |
177 diffopts: mdiff.diffopts | |
178 followrename: bool | |
179 followmerge: bool | |
180 | |
177 def __init__(self, **opts): | 181 def __init__(self, **opts): |
178 for k, v in self.defaults.items(): | 182 for k, v in self.defaults.items(): |
179 setattr(self, k, opts.get(k, v)) | 183 setattr(self, k, opts.get(k, v)) |
180 | 184 |
181 @util.propertycache | 185 @util.propertycache |
182 def shortstr(self): | 186 def shortstr(self) -> bytes: |
183 """represent opts in a short string, suitable for a directory name""" | 187 """represent opts in a short string, suitable for a directory name""" |
184 result = b'' | 188 result = b'' |
185 if not self.followrename: | 189 if not self.followrename: |
186 result += b'r0' | 190 result += b'r0' |
187 if not self.followmerge: | 191 if not self.followmerge: |