Mercurial > hg
comparison hgext/blackbox.py @ 49853:e63ab79b2fa1
typing: add some assertions that a variable isn't None
In the case of blackbox, there's a default limit if one isn't explicitly
supplied. For the monotone regex, neither group is optional, so a match means
it's not None.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 05 Jan 2023 17:15:27 -0500 |
parents | 642e31cb55f0 |
children | 7f8f6fe13fa9 4323af38e3f2 |
comparison
equal
deleted
inserted
replaced
49852:564d360fc98e | 49853:e63ab79b2fa1 |
---|---|
215 | 215 |
216 if not repo.vfs.exists(b'blackbox.log'): | 216 if not repo.vfs.exists(b'blackbox.log'): |
217 return | 217 return |
218 | 218 |
219 limit = opts.get('limit') | 219 limit = opts.get('limit') |
220 assert limit is not None # help pytype | |
221 | |
220 fp = repo.vfs(b'blackbox.log', b'r') | 222 fp = repo.vfs(b'blackbox.log', b'r') |
221 lines = fp.read().split(b'\n') | 223 lines = fp.read().split(b'\n') |
222 | 224 |
223 count = 0 | 225 count = 0 |
224 output = [] | 226 output = [] |