From a1ab32afb382008ffca2e6c6511d2b609587c8a4 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Mon, 3 May 2021 05:17:41 -0700 Subject: [PATCH] Remove assertion in type_conversions/to_tuple (Python3 prep) This function starts by an assertion that the given parameter is a string by checking its type. However, in Python 2, strings can take 2 forms: type "str", or type "unicode". What we'd like to do to help migrating this code to Python, is to start using unicode strings throughout. But then, if we want to keep the assertion, the problem becomes that we would need to change it to check for type "unicode", which would be incompatible with Python 3, where type "unicode" no longer exists. Since the assertion is not really all that helpful and even possibly unnecessarily restrictive, this commit simply removes it. Change-Id: If9014c35b5f2107cfc0bb03338b9a977f44587ba --- hooks/type_conversions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/hooks/type_conversions.py b/hooks/type_conversions.py index e2a42ea..3360bcf 100644 --- a/hooks/type_conversions.py +++ b/hooks/type_conversions.py @@ -35,15 +35,12 @@ def to_tuple(val): PARAMETERS val: The value to convert, assumed to be a string for now. - An assertion will be raised if this is not the case. REMARKS Handling of val being a tuple, or even maybe other types could be added as well. But there is no need for it at the moment. """ - assert isinstance(val, str) - # Handle the case where val is empty separately, as split would # return a tuple containing an empty string. We want to return # an empty tuple in this case.