(func=None, /, *, typed=False)
return decorator
Internal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
Internal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
Internal wrapper caching __getitem__ of generic types with a fallback to original function for non - hashable arguments .
def _tp_cache(func=None, /, *, typed=False):
    """Internal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    """
    def decorator(func):
        cached = functools.lru_cache(typed=typed)(func)
        _cleanups.append(cached.cache_clear)

        @functools.wraps(func)
        def inner(*args, **kwds):
            try:
                return cached(*args, **kwds)
            except TypeError:
                pass  # All real errors (not unhashable args) are raised below.
            return func(*args, **kwds)
        return inner

    if func is not None:
        return decorator(func)

    return decorator
def _tp_cache ( func = None , / , * , typed = False ) : def decorator ( func ) : cached = functools . lru_cache ( typed = typed ) ( func ) _cleanups . append ( cached . cache_clear ) @ functools . wraps ( func ) def inner ( * args , * * kwds ) : try : return cached ( * args , * * kwds ) except TypeError : pass # All real errors (not unhashable args) are raised below. return func ( * args , * * kwds ) return inner if func is not None : return decorator ( func ) return decorator