Repository: reagento/dishka

Issue:
 `self` parameter hints of methods is treated as dependency

Discussion:

Patch:
diff --git a/src/dishka/dependency_source.py b/src/dishka/dependency_source.py
index 05aa6e2..b03800e 100644
--- a/src/dishka/dependency_source.py
+++ b/src/dishka/dependency_source.py
@@ -6,6 +6,7 @@ from inspect import (
     iscoroutinefunction,
     isfunction,
     isgeneratorfunction,
+    signature,
 )
 from typing import (
     Any,
@@ -117,7 +118,10 @@ def make_factory(
         possible_dependency = source
         is_to_bind = False
     elif isfunction(source):
+        params = signature(source).parameters
+        self = next(iter(params.values()))
         hints = get_type_hints(source, include_extras=True)
+        hints.pop(self.name, None)
         possible_dependency = hints.pop("return", None)
         is_to_bind = True
     else:


Test patch:
diff --git a/tests/unit/test_provider.py b/tests/unit/test_provider.py
index f0ea535..c02647e 100644
--- a/tests/unit/test_provider.py
+++ b/tests/unit/test_provider.py
@@ -77,3 +77,13 @@ def test_provider_instance_braces():
 
     provider = MyProvider(scope=Scope.REQUEST)
     assert provider.foo.scope == Scope.REQUEST
+
+
+def test_self_hint():
+    class MyProvider(Provider):
+        @provide
+        def foo(self: Provider) -> str:
+            return "hello"
+
+    provider = MyProvider(scope=Scope.REQUEST)
+    assert not provider.foo.dependencies