diff mercurial/sslutil.py @ 48491:08af0adc235c

pytype: stop excluding ssutil.py Pytype simply can't distinguish the type for this one entry's value from the other values: File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in _hostsettings: No attribute 'append' on None [attribute-error] In Optional[Union[Any, List[nothing], bool, bytes]] File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in _hostsettings: No attribute 'append' on bool [attribute-error] In Optional[Union[Any, List[nothing], bool, bytes]] File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in _hostsettings: No attribute 'append' on bytes [attribute-error] In Optional[Union[Any, List[nothing], bool, bytes]] File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in _hostsettings: No attribute 'append' on None [attribute-error] In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]] File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in _hostsettings: No attribute 'append' on bool [attribute-error] In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]] File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in _hostsettings: No attribute 'append' on bytes [attribute-error] In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]] Differential Revision: https://phab.mercurial-scm.org/D11931
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 14 Dec 2021 20:13:10 -0500
parents d4ba4d51f85f
children 6000f5b25c9b
line wrap: on
line diff
--- a/mercurial/sslutil.py	Tue Dec 14 19:13:30 2021 -0500
+++ b/mercurial/sslutil.py	Tue Dec 14 20:13:10 2021 -0500
@@ -139,12 +139,18 @@
 
         alg, fingerprint = fingerprint.split(b':', 1)
         fingerprint = fingerprint.replace(b':', b'').lower()
+        # pytype: disable=attribute-error
+        # `s` is heterogeneous, but this entry is always a list of tuples
         s[b'certfingerprints'].append((alg, fingerprint))
+        # pytype: enable=attribute-error
 
     # Fingerprints from [hostfingerprints] are always SHA-1.
     for fingerprint in ui.configlist(b'hostfingerprints', bhostname):
         fingerprint = fingerprint.replace(b':', b'').lower()
+        # pytype: disable=attribute-error
+        # `s` is heterogeneous, but this entry is always a list of tuples
         s[b'certfingerprints'].append((b'sha1', fingerprint))
+        # pytype: enable=attribute-error
         s[b'legacyfingerprint'] = True
 
     # If a host cert fingerprint is defined, it is the only thing that