From cacb00f622c30acc4af482ef5a34102fa5cad28b Mon Sep 17 00:00:00 2001 From: Fred C Date: Sat, 17 Feb 2024 06:00:39 -0800 Subject: [PATCH] Fix typing errors --- eqsl/sendcard.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eqsl/sendcard.py b/eqsl/sendcard.py index 11d2151..27753f4 100755 --- a/eqsl/sendcard.py +++ b/eqsl/sendcard.py @@ -16,6 +16,7 @@ import sys from argparse import ArgumentParser from importlib.metadata import version +from pathlib import Path from subprocess import call from typing import Optional @@ -36,13 +37,13 @@ __version__ = version("e-qsl") -def send_cards(filename: str, show_card: bool, keep_card: bool) -> None: +def send_cards(filename: Path, show_card: bool, keep_card: bool) -> None: eqsl: Optional[str] = shutil.which('eqsl') if not eqsl: raise FileNotFoundError('eqsl not found') - args: list[str] = [eqsl, '-a', filename] - if not os.path.exists(filename): + args: list[str] = [eqsl, '-a', str(filename)] + if not filename.exists(): return if show_card: args.append('-s') @@ -65,7 +66,7 @@ def __call__(self, change: Change, path: str) -> bool: def main() -> None: - parser = ArgumentParser(description="DXCC entities lookup") + parser = ArgumentParser(description="Watch for the creation on an adif file and call eqsl") parser.add_argument("-s", "--show", action="store_true", default=False, help="Show the card") parser.add_argument("-k", "--keep", action="store_true", default=False, @@ -89,7 +90,7 @@ def main() -> None: continue for _, filename in changes: logging.info('Calling send_cards with %s', filename) - send_cards(full_name, opts.show, opts.keep) + send_cards(Path(full_name), opts.show, opts.keep) if __name__ == "__main__":