summaryrefslogtreecommitdiff
path: root/gitlab/client.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1392 from bbatliner/patch-1Max Wittig2021-04-231-10/+18
|\ | | | | Improvements to HTTP requests
| * fix: only append kwargs as query parametersBrendan Batliner2021-04-071-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some arguments to `http_request` were being read from kwargs, but kwargs is where this function creates query parameters from, by default. In the absence of a `query_parameters` param, the function would construct URLs with query parameters such as `retry_transient_errors=True` despite those parameters having no meaning to the API to which the request was sent. This change names those arguments that are specific to `http_request` so that they do not end up as query parameters read from kwargs.
| * fix: only add query_parameters to GitlabList onceBrendan Batliner2021-04-071-0/+3
| | | | | | | | Fixes #1386
* | fix: update user's bool data and avatarDylann Cordel2021-04-221-0/+6
|/ | | | | | | If we want to update email, avatar and do not send email confirmation change (`skip_reconfirmation` = True), `MultipartEncoder` will try to encode everything except None and bytes. So it tries to encode bools. Casting bool's values to their stringified int representation fix it.
* chore: put assert statements inside 'if TYPE_CHECKING:'John L. Villalovos2021-03-021-8/+15
| | | | | | | | | | | To be safe that we don't assert while running, put the assert statements, which are used by mypy to check that types are correct, inside an 'if TYPE_CHECKING:' block. Also, instead of asserting that the item is a dict, instead assert that it is not a requests.Response object. Theoretically the JSON could return as a list or dict, though at this time we are assuming a dict.
* chore: disallow incomplete type defsJohn L. Villalovos2021-02-281-17/+19
| | | | | | | | | | Don't allow a partially annotated function definition. Either none of the function is annotated or all of it must be. Update code to ensure no-more partially annotated functions. Update gitlab/cli.py with better type-hints. Changed Tuple[Any, ...] to Tuple[str, ...]
* chore: add and fix some type-hints in gitlab/client.pyJohn L. Villalovos2021-02-271-4/+6
| | | | Was able to figure out better type-hints for gitlab/client.py
* chore: add type-hints to gitlab/client.pyJohn L. Villalovos2021-02-261-77/+139
| | | | Adding some initial type-hints to gitlab/client.py
* chore: remove unused function _construct_url()John L. Villalovos2021-02-231-18/+0
| | | | | | The function _construct_url() was used by the v3 API. All usage of the function was removed in commit fe89b949922c028830dd49095432ba627d330186
* feat: add an initial mypy test to tox.iniJohn L. Villalovos2021-02-221-1/+1
| | | | Add an initial mypy test to test gitlab/base.py and gitlab/__init__.py
* chore: remove usage of 'from ... import *' in client.pyJohn L. Villalovos2021-02-221-16/+16
| | | | | | | | | | | | | | | | In gitlab/client.py remove usage of: * from gitlab.const import * * from gitlab.exceptions import * Change them to: * import gitlab.const * import gitlab.exceptions Update code to explicitly reference things in gitlab.const and gitlab.exceptions A flake8 run no longer lists any undefined variables. Before it listed possible undefined variables.
* chore: explicitly import gitlab.v4.objects/cliJohn L. Villalovos2021-02-211-4/+16
| | | | | | | | | | | | | | | | | As we only support the v4 Gitlab API, explicitly import gitlab.v4.objects and gitlab.v4.clie instead of dynamically importing it depending on the API version. This has the added benefit of mypy being able to type check the Gitlab __init__() function as currently it will fail if we enable type checking of __init__() it will fail. Also, this also helps by not confusing tools like pyinstaller/cx_freeze with dynamic imports so you don't need hooks for standalone executables. And according to https://docs.gitlab.com/ee/api/, "GraphQL co-exists with the current v4 REST API. If we have a v5 API, this should be a compatibility layer on top of GraphQL."
* refactor: move Gitlab and GitlabList to gitlab/client.pyJohn L. Villalovos2021-02-181-0/+858
Move the classes Gitlab and GitlabList from gitlab/__init__.py to the newly created gitlab/client.py file. Update one test case that was depending on requests being defined in gitlab/__init__.py