From 894b552159e17d798f76cd6f1a4a9a78fbc1fa10 Mon Sep 17 00:00:00 2001 From: hl Date: Sat, 23 Nov 2024 18:23:43 +0800 Subject: [PATCH] update --- sort_known_hosts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sort_known_hosts.py b/sort_known_hosts.py index da032b2..9937501 100755 --- a/sort_known_hosts.py +++ b/sort_known_hosts.py @@ -11,18 +11,18 @@ from collections import namedtuple class Entry(namedtuple('Entry', ['host', 'algorithm', 'hash'])): separator: str = '.' - def __str__(self): + def __str__(self) -> str: return f'{self.host} {self.algorithm} {self.hash}' @property - def key(self): + def key(self) -> str: return f'{self.algorithm}{self.separator}{self.hash}' def main(args): - filename: Path | None = getattr(args, 'known_hosts', None) + filename: Path = getattr(args, 'known_hosts', Path()) file_path = filename.resolve() - if not file_path.exists() or not file_path.is_file(): + if not file_path.is_file(): sys.exit(1) entryMap = {}