From e5b01bb04331676cbc5e202993e4bf883cb97633 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 11 Jan 2021 14:20:43 -0500 Subject: upgrade to Python 3.9 --- frozen_deps/base58/__main__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'frozen_deps/base58/__main__.py') diff --git a/frozen_deps/base58/__main__.py b/frozen_deps/base58/__main__.py index b76fdad..3a6f5d2 100644 --- a/frozen_deps/base58/__main__.py +++ b/frozen_deps/base58/__main__.py @@ -1,10 +1,18 @@ import argparse import sys +from typing import Callable, Dict, Tuple from base58 import b58decode, b58decode_check, b58encode, b58encode_check +_fmap = { + (False, False): b58encode, + (False, True): b58encode_check, + (True, False): b58decode, + (True, True): b58decode_check +} # type: Dict[Tuple[bool, bool], Callable[[bytes], bytes]] -def main(): + +def main() -> None: '''Base58 encode or decode FILE, or standard input, to standard output.''' stdout = sys.stdout.buffer @@ -26,12 +34,7 @@ def main(): help='append a checksum before encoding') args = parser.parse_args() - fun = { - (False, False): b58encode, - (False, True): b58encode_check, - (True, False): b58decode, - (True, True): b58decode_check - }[(args.decode, args.check)] + fun = _fmap[(args.decode, args.check)] data = args.file.buffer.read() -- cgit v1.2.3-70-g09d2