Describe the bug
When I tried to use @cbv(router) and added a class attribute with Depends, my pylint started complaining with E1101: Instance of 'Depends' has no '...' member (no-member).
To Reproduce
fromfastapiimportAPIRouter, Path, Depends, Queryfromfastapi_utils.cbvimportcbvrouter=APIRouter()
classControllerClass:
defget_sample() ->str:
return"sample"defget_controller() ->ControllerClass:
returnControllerClass()
@cbv(router)classMyRouter:
controller: ControllerClass=Depends(get_controller)
@router.get("/sample")asyncdefsample(self) ->str:
returnself.controller.get_sample() # <- this line recognizes self.controller as `Depends` instance, not `ControllerClass`# > E1101: Instance of 'Depends' has no 'get_sample' member (no-member)Although, functionally everything works just fine.
Expected behavior
The typing of the class var should be inferred as ControllerClass, not Depends.
Environment:
- OS: MacOS 19.5.0 Darwin Kernel Version
- FastAPI Utils, FastAPI, and Pydantic versions:
>>>print(fastapi_utils.__version__)
0.2.1>>>print(fastapi.__version__)
0.55.1>>>print(pydantic.utils.version_info())
pydanticversion: 1.5.1pydanticcompiled: Truepythonversion: 3.7.7 (default, May62020, 04:59:01) [Clang4.0.1 (tags/RELEASE_401/final)]
platform: Darwin-19.5.0-x86_64-i386-64bitoptionaldeps. installed: ['typing-extensions']
- Python version, get it with:
Python 3.7.7
Describe the bug
When I tried to use
@cbv(router)and added a class attribute withDepends, my pylint started complaining withE1101: Instance of 'Depends' has no '...' member (no-member).To Reproduce
Although, functionally everything works just fine.
Expected behavior
The typing of the class var should be inferred as
ControllerClass, notDepends.Environment:
Python 3.7.7