This commit is contained in:
hl committed 2024-11-23 18:23:43 +08:00
1 parent 626d7e433a
commit 894b552159
1 file changed
+4 -4
+4 -4
View File
@@ -11,18 +11,18 @@ from collections import namedtuple
class Entry(namedtuple('Entry', ['host', 'algorithm', 'hash'])): class Entry(namedtuple('Entry', ['host', 'algorithm', 'hash'])):
separator: str = '.' separator: str = '.'
def __str__(self): def __str__(self) -> str:
return f'{self.host} {self.algorithm} {self.hash}' return f'{self.host} {self.algorithm} {self.hash}'
@property @property
def key(self): def key(self) -> str:
return f'{self.algorithm}{self.separator}{self.hash}' return f'{self.algorithm}{self.separator}{self.hash}'
def main(args): def main(args):
filename: Path | None = getattr(args, 'known_hosts', None) filename: Path = getattr(args, 'known_hosts', Path())
file_path = filename.resolve() file_path = filename.resolve()
if not file_path.exists() or not file_path.is_file(): if not file_path.is_file():
sys.exit(1) sys.exit(1)
entryMap = {} entryMap = {}