Mercurial > public > mercurial-scm > hg
comparison mercurial/sslutil.py @ 46113:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | 89a2afe31e82 |
children | 521ac0d7047f |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
14 import re | 14 import re |
15 import ssl | 15 import ssl |
16 | 16 |
17 from .i18n import _ | 17 from .i18n import _ |
18 from .pycompat import getattr | 18 from .pycompat import getattr |
19 from .node import hex | |
19 from . import ( | 20 from . import ( |
20 encoding, | 21 encoding, |
21 error, | 22 error, |
22 node, | |
23 pycompat, | 23 pycompat, |
24 util, | 24 util, |
25 ) | 25 ) |
26 from .utils import ( | 26 from .utils import ( |
27 hashutil, | 27 hashutil, |
760 return | 760 return |
761 | 761 |
762 # If a certificate fingerprint is pinned, use it and only it to | 762 # If a certificate fingerprint is pinned, use it and only it to |
763 # validate the remote cert. | 763 # validate the remote cert. |
764 peerfingerprints = { | 764 peerfingerprints = { |
765 b'sha1': node.hex(hashutil.sha1(peercert).digest()), | 765 b'sha1': hex(hashutil.sha1(peercert).digest()), |
766 b'sha256': node.hex(hashlib.sha256(peercert).digest()), | 766 b'sha256': hex(hashlib.sha256(peercert).digest()), |
767 b'sha512': node.hex(hashlib.sha512(peercert).digest()), | 767 b'sha512': hex(hashlib.sha512(peercert).digest()), |
768 } | 768 } |
769 | 769 |
770 def fmtfingerprint(s): | 770 def fmtfingerprint(s): |
771 return b':'.join([s[x : x + 2] for x in range(0, len(s), 2)]) | 771 return b':'.join([s[x : x + 2] for x in range(0, len(s), 2)]) |
772 | 772 |