Skip to content

Instantly share code, notes, and snippets.

View caiquecp's full-sized avatar
💭
Working on RPG Simple Dice PLUS

Caique C Pereira caiquecp

💭
Working on RPG Simple Dice PLUS
View GitHub Profile
@caiquecp
caiquecp / python-di.py
Last active January 31, 2022 20:42
A very simple (and uncompleted) dependency injection decorator for Python.
import functools
from inspect import signature, Parameter
# Dict to store our dependencies
__dependencies__ = {}
def register_dependency(dependency: object) -> None:
# Get the class name to use it as an id in our dependencies dict
cls_name = dependency.__class__.__name__