seandstewart / typical

Typical: Fast, simple, & correct data-validation using Python 3 typing.
https://python-typical.org
MIT License
182 stars 9 forks source link

issubclass error after version 2.6.4 #183

Closed timcera closed 3 years ago

timcera commented 3 years ago

Description

In all versions after 2.6.4 many of my tests that used to pass are now failing with the error:

___________________________________________________________________ TestRead.test_creation ___________________________________________________________________

self = <tests.test_calculate_fdc.TestRead testMethod=test_creation>

    def test_creation(self):
>       _ = tstoolbox.calculate_fdc(input_ts=self.fdata)

tests/test_calculate_fdc.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../pythons/working_3.8.0/lib/python3.8/site-packages/typic/api.py:189: in func_wrapper
    return func(*args, **kwargs)
src/tstoolbox/functions/calculate_fdc.py:207: in calculate_fdc
    xdat = ppf(tsutils.set_plotting_position(tmptsd.count(), plotting_position))
../../pythons/working_3.8.0/lib/python3.8/site-packages/typic/api.py:188: in func_wrapper
    args, kwargs = enforcer(*args, **kwargs)
../../pythons/working_3.8.0/lib/python3.8/site-packages/typic/serde/binder.py:168: in enforce_binding
    vargs[i] = __binding[i](v)
<typical generated deserializer_2446244414474070853>:11: in deserializer_2446244414474070853
    if issubclass(Literal, vtype):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

st = typing.Literal, t = <class 'str'>

    @lru_cache(maxsize=None)
    def cached_issubclass(st: Type, t: Union[Type, Tuple[Type, ...]]) -> bool:
        """A cached result of :py:func:`issubclass`."""
>       return issubclass(st, t)
E       TypeError: issubclass() arg 1 must be a class

../../pythons/working_3.8.0/lib/python3.8/site-packages/typic/util.py:504: TypeError

What I Did

I actually don't know how to fix.

I looked through existing typical issues and looking at the commit descriptions to try an get a clue as to what I am doing wrong.