Skip to content

Instantly share code, notes, and snippets.

View MyPyDavid's full-sized avatar

David Wallace MyPyDavid

  • Germany
View GitHub Profile
@ramonrosa
ramonrosa / decorator_with_kwargs.py
Last active March 9, 2024 10:18
Decorator factory for decorator with optional kwargs
from functools import partial, wraps
from inspect import signature
from typing import Callable
def decorator_with_kwargs(decorator: Callable) -> Callable:
"""Decorator factory to give decorated decorators the skill to receive
optional keyword arguments.
If a decorator "some_decorator" is decorated with this function: