Mercurial > public > mercurial-scm > hg-stable
diff contrib/automation/hgautomation/ssh.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 65b3ef162b39 |
children | 24ee91ba9aa8 |
line wrap: on
line diff
--- a/contrib/automation/hgautomation/ssh.py Sat Oct 05 10:29:34 2019 -0400 +++ b/contrib/automation/hgautomation/ssh.py Sun Oct 06 09:45:02 2019 -0400 @@ -11,14 +11,13 @@ import time import warnings -from cryptography.utils import ( - CryptographyDeprecationWarning, -) +from cryptography.utils import CryptographyDeprecationWarning import paramiko def wait_for_ssh(hostname, port, timeout=60, username=None, key_filename=None): """Wait for an SSH server to start on the specified host and port.""" + class IgnoreHostKeyPolicy(paramiko.MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): return @@ -28,17 +27,23 @@ # paramiko triggers a CryptographyDeprecationWarning in the cryptography # package. Let's suppress with warnings.catch_warnings(): - warnings.filterwarnings('ignore', - category=CryptographyDeprecationWarning) + warnings.filterwarnings( + 'ignore', category=CryptographyDeprecationWarning + ) while True: client = paramiko.SSHClient() client.set_missing_host_key_policy(IgnoreHostKeyPolicy()) try: - client.connect(hostname, port=port, username=username, - key_filename=key_filename, - timeout=5.0, allow_agent=False, - look_for_keys=False) + client.connect( + hostname, + port=port, + username=username, + key_filename=key_filename, + timeout=5.0, + allow_agent=False, + look_for_keys=False, + ) return client except socket.error: