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

feat: support for injector library #176

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

OlehChyhyryn
Copy link
Contributor

support for injector library, which is often used in Python for dependency injection pattern implementation

@OlehChyhyryn
Copy link
Contributor Author

OlehChyhyryn commented Nov 14, 2023

I like the staff you implemented in this linter; we found it useful in our projects. We faced a conflict with the injector project because it used typing annotation in runtime.

For example:

from injector import Inject
from service_b import ServiceB

class ServiceA:
     def __init__(self, service_b: Inject[ServiceB]) -> None:

In this pull request I want to add the support for such functionality for ones using this library as we do.

@OlehChyhyryn OlehChyhyryn force-pushed the feat/dependency-injector branch 2 times, most recently from 9834b1d to aed5627 Compare November 14, 2023 13:11
Copy link
Member

@sondrelg sondrelg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Haven't really used this personally, so will trust that this is sufficient for support. Spotted one typo, but the rest looks solid 👍

@@ -40,6 +40,7 @@ def _get_error(example: str, *, error_code_filter: Optional[str] = None, **kwarg
mock_options.type_checking_fastapi_enabled = False
mock_options.type_checking_fastapi_dependency_support_enabled = False
mock_options.type_checking_pydantic_enabled_baseclass_passlist = []
mock_options.type_checking_injector_enables = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a typo here. Does that mean this isn't needed?

Suggested change
mock_options.type_checking_injector_enables = False
mock_options.type_checking_injector_enabled = False

Copy link
Contributor Author

@OlehChyhyryn OlehChyhyryn Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo is fixed and squashed into a single commit.

@OlehChyhyryn
Copy link
Contributor Author

Code has been rebased onto the current main branch

@sondrelg sondrelg merged commit 1ede4bd into snok:main Nov 29, 2023
6 checks passed
@sondrelg
Copy link
Member

Thanks @OlehChyhyryn!

@OlehChyhyryn OlehChyhyryn deleted the feat/dependency-injector branch June 3, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants