Mityuha / fresh-bakery

Bake dependency injections asynchronously and stupidly simple
https://fresh-bakery.readthedocs.io/en/latest/
MIT License
21 stars 0 forks source link

Hand made any object (not only cakes) #26

Closed Mityuha closed 2 years ago

Mityuha commented 2 years ago

Now you can customize only cakes with hand_made function

class MyBakery(Bakery):
    int_type=hand_made(
            Cake(int),
            cake_baking_method=BakingMethod.BAKE_NO_BAKE
        )

But maybe it would be convenient to write

class MyBakery(Bakery):
    int_type=hand_made(
           int,
           cake_baking_method=BakingMethod.BAKE_NO_BAKE
        )

More real life example:

@contextmanager
def my_func():
    yield 1

class MyBakery(Bakery):
    my_func_alias = hand_made(
        Cake(my_func),   # <<< extra Cake?
        cake_baking_method=BakingMethod.BAKE_NO_BAKE,
    )

Fix documentation