# HG changeset patch # User Matt Harbison # Date 1672956927 18000 # Node ID e63ab79b2fa1bf689c140c3f29461cd39976f48d # Parent 564d360fc98e7e97c661fec0be9a5c104d5c6b8a 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. diff -r 564d360fc98e -r e63ab79b2fa1 hgext/blackbox.py --- a/hgext/blackbox.py Thu Jan 05 17:09:41 2023 -0500 +++ b/hgext/blackbox.py Thu Jan 05 17:15:27 2023 -0500 @@ -217,6 +217,8 @@ return limit = opts.get('limit') + assert limit is not None # help pytype + fp = repo.vfs(b'blackbox.log', b'r') lines = fp.read().split(b'\n') diff -r 564d360fc98e -r e63ab79b2fa1 hgext/convert/monotone.py --- a/hgext/convert/monotone.py Thu Jan 05 17:09:41 2023 -0500 +++ b/hgext/convert/monotone.py Thu Jan 05 17:15:27 2023 -0500 @@ -243,6 +243,7 @@ m = self.cert_re.match(e) if m: name, value = m.groups() + assert value is not None # help pytype value = value.replace(br'\"', b'"') value = value.replace(br'\\', b'\\') certs[name] = value