From 1167742f75fa454362a5d48125b2c972d2a132df Mon Sep 17 00:00:00 2001 From: sparky8512 <76499194+sparky8512@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:01:53 -0700 Subject: [PATCH] Correct Python 3.7 compatibility hack mypy complained about the signature of conditional def of get_args not matching the one from typing module, so I made it match, but apparently hadn't actually tested it with Python 3.7. It was just the return type hint, but it sill needs to parse at run time. Also, fix up a few other (non-error) gripes from pylint. --- starlink_grpc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/starlink_grpc.py b/starlink_grpc.py index 2a167ba..7ce9e9c 100644 --- a/starlink_grpc.py +++ b/starlink_grpc.py @@ -352,10 +352,10 @@ try: except ImportError: # Python 3.7 does not have TypedDict, so fake it so the run time still # works, even though static type checker probably will not. - def TypedDict(name, types): + def TypedDict(name, types): # pylint: disable=invalid-name return type(name, (dict,), {"__annotations__": types}) - def get_args(tp: Any) -> tuple[Any, ...]: + def get_args(tp: Any) -> Tuple[Any, ...]: return tp.__args__ @@ -483,11 +483,11 @@ _FIELD_NAME_MAP = { def _field_names(hint_type): - return list(_FIELD_NAME_MAP.get(key, key) for key in get_type_hints(hint_type).keys()) + return list(_FIELD_NAME_MAP.get(key, key) for key in get_type_hints(hint_type)) def _field_names_bulk(hint_type): - return list(key + "[]" for key in get_type_hints(hint_type).keys()) + return list(key + "[]" for key in get_type_hints(hint_type)) def _field_types(hint_type):