Skip to content

@inject with multiple @wraps #597

Closed
Closed
@rmk135

Description

@rmk135

Need to check if the following behavior can be improved:

@fabiocerqueira I faced the same issue as well, adding wraps is breaking the inject.
@rmk135 could you please have a look?

My use case is similar to what Fabio mentioned:

def tagger(tag):
    def inner(func):
        # @wraps(func)  # <-- using wraps break inject
        @inject
        def tagger_wrapper(text, sep=Provide[Container.conf.sep], **kwargs):
            result = func(text, **kwargs)
            return f"{result}{sep}({tag}[{func.__name__}])"

        return tagger_wrapper

    return inner

Originally posted by @Jitesh-Khuttan in #454 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions