Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers.Dict does not work with non-string keys #435

Closed
daniel55411 opened this issue Mar 26, 2021 · 1 comment
Closed

providers.Dict does not work with non-string keys #435

daniel55411 opened this issue Mar 26, 2021 · 1 comment
Assignees
Labels

Comments

@daniel55411
Copy link

Hello!

I am trying create providers.Dict with non-string keys and getting TypeError: set_kwargs() keywords must be strings. Is this error? Or maybe am I doing something wrong?

from dependency_injector import providers
from dependency_injector.containers import DeclarativeContainer


class SomeClass:
    pass


class ExampleContainer(DeclarativeContainer):
    some_dict = providers.Dict({
        SomeClass: providers.Factory(SomeClass),
        'key.with.periods': providers.Factory(SomeClass),
        'key-with-dashes': providers.Factory(SomeClass),
    })


if __name__ == '__main__':
    container = ExampleContainer()
    container.some_dict()
@rmk135
Copy link
Member

rmk135 commented Mar 30, 2021

Hi @daniel55411 ,

Fixed in version 4.31.2. Thanks for reporting the issue. It's a regression of one of the recent changes. I'm sorry it was there.

Best,
Roman

@rmk135 rmk135 self-assigned this Mar 30, 2021
@rmk135 rmk135 added the bug label Mar 30, 2021
@rmk135 rmk135 closed this as completed Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants