From 8f731c6a7e4d3e2156babdf0a7c15d2d5540b6f6 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 27 Nov 2019 12:41:45 +0000 Subject: [PATCH] TYP: some types for pandas/util/_exceptions.py --- pandas/util/_exceptions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/util/_exceptions.py b/pandas/util/_exceptions.py index 4f2cbd4314b8e..b8719154eb791 100644 --- a/pandas/util/_exceptions.py +++ b/pandas/util/_exceptions.py @@ -1,15 +1,16 @@ import contextlib +from typing import Tuple @contextlib.contextmanager -def rewrite_exception(old_name, new_name): +def rewrite_exception(old_name: str, new_name: str): """Rewrite the message of an exception.""" try: yield except Exception as err: msg = err.args[0] msg = msg.replace(old_name, new_name) - args = (msg,) + args: Tuple[str, ...] = (msg,) if len(err.args) > 1: args = args + err.args[1:] err.args = args