- Notifications
You must be signed in to change notification settings - Fork673
Closed
Labels
Description
Hi, while using the library I've noticed some lack of typing info.
Given the following code in a file calledgl.py
:
fromgitlabimportGitlabfromgitlab.v4.objectsimportCurrentUserdefget_current_user(gl:Gitlab)->CurrentUser:gl.auth()returngl.userdefget_project(gl:Gitlab,name:str)->str:returngl.projects.get(name).pathdefget_user(gl:Gitlab,name:str)->str:returngl.users.list(username=name)[0].usernamedefget_group(gl:Gitlab,name:str)->str:returngl.groups.get(name).pathif__name__=='__main__':gl=Gitlab('https://gitlab.com',private_token='xxx')user=get_current_user(gl)print(user.username)print(get_project(gl,"gitlab-org/gitlab"))print(get_user(gl,"dAnjou"))print(get_group(gl,"gitlab-org"))
The commandmypy --strict gl.py
returns a few errors:
gl.py:1: error: Module "gitlab" does not explicitly export attribute "Gitlab"; implicit reexport disabledgl.py:2: error: Module "gitlab.v4.objects" does not explicitly export attribute "CurrentUser"; implicit reexport disabledgl.py:11: error: Returning Any from function declared to return "str"gl.py:15: error: Returning Any from function declared to return "str"gl.py:19: error: Returning Any from function declared to return "str"Found 5 errors in 1 file (checked 1 source file)
python-gitlab==2.10.1
- default API version 4 on gitlab.com