comparison mercurial/sslutil.py @ 48530: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
comparison
equal deleted inserted replaced
48529:81805bba11f9 48530:08af0adc235c
137 hint=_(b'must begin with "sha1:", "sha256:", or "sha512:"'), 137 hint=_(b'must begin with "sha1:", "sha256:", or "sha512:"'),
138 ) 138 )
139 139
140 alg, fingerprint = fingerprint.split(b':', 1) 140 alg, fingerprint = fingerprint.split(b':', 1)
141 fingerprint = fingerprint.replace(b':', b'').lower() 141 fingerprint = fingerprint.replace(b':', b'').lower()
142 # pytype: disable=attribute-error
143 # `s` is heterogeneous, but this entry is always a list of tuples
142 s[b'certfingerprints'].append((alg, fingerprint)) 144 s[b'certfingerprints'].append((alg, fingerprint))
145 # pytype: enable=attribute-error
143 146
144 # Fingerprints from [hostfingerprints] are always SHA-1. 147 # Fingerprints from [hostfingerprints] are always SHA-1.
145 for fingerprint in ui.configlist(b'hostfingerprints', bhostname): 148 for fingerprint in ui.configlist(b'hostfingerprints', bhostname):
146 fingerprint = fingerprint.replace(b':', b'').lower() 149 fingerprint = fingerprint.replace(b':', b'').lower()
150 # pytype: disable=attribute-error
151 # `s` is heterogeneous, but this entry is always a list of tuples
147 s[b'certfingerprints'].append((b'sha1', fingerprint)) 152 s[b'certfingerprints'].append((b'sha1', fingerprint))
153 # pytype: enable=attribute-error
148 s[b'legacyfingerprint'] = True 154 s[b'legacyfingerprint'] = True
149 155
150 # If a host cert fingerprint is defined, it is the only thing that 156 # If a host cert fingerprint is defined, it is the only thing that
151 # matters. No need to validate CA certs. 157 # matters. No need to validate CA certs.
152 if s[b'certfingerprints']: 158 if s[b'certfingerprints']: