summaryrefslogtreecommitdiff
path: root/gitlab
Commit message (Collapse)AuthorAgeFilesLines
* test(cli): add more real class scenariosfix/parse-cli-objects-camelcaseNejc Habjan2021-03-071-0/+6
|
* fix(cli): fix parsing CLI objects to classnamesNejc Habjan2021-03-073-18/+49
|
* Merge pull request #1336 from em-/fix/quote-everythingNejc Habjan2021-03-072-3/+11
|\ | | | | fix: handle tags like debian/2%2.6-21 as identifiers
| * fix: handle tags like debian/2%2.6-21 as identifiersEmanuele Aina2021-03-052-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git refnames are relatively free-form and can contain all sort for special characters, not just `/` and `#`, see http://git-scm.com/docs/git-check-ref-format In particular, Debian's DEP-14 standard for storing packaging in git repositories mandates the use of the `%` character in tags in some cases like `debian/2%2.6-21`. Unfortunately python-gitlab currently only escapes `/` to `%2F` and in some cases `#` to `%23`. This means that when using the commit API to retrieve information about the `debian/2%2.6-21` tag only the slash is escaped before being inserted in the URL path and the `%` is left untouched, resulting in something like `/api/v4/projects/123/repository/commits/debian%2F2%2.6-21`. When urllib3 seees that it detects the invalid `%` escape and then urlencodes the whole string, resulting in `/api/v4/projects/123/repository/commits/debian%252F2%252.6-21`, where the original `/` got escaped twice and produced `%252F`. To avoid the issue, fully urlencode identifiers and parameters to avoid the urllib3 auto-escaping in all cases. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
* | chore: add type-hints for gitlab/mixins.pyJohn L. Villalovos2021-03-061-57/+313
| | | | | | | | | | | | | | * Added type-hints for gitlab/mixins.py * Changed use of filter with a lambda expression to list-comprehension. mypy was not able to understand the previous code. Also list-comprehension is better :)
* | Merge pull request #1353 from JohnVillalovos/jlvillal/mypy_baseNejc Habjan2021-03-061-0/+5
|\ \ | | | | | | chore: add type hints to gitlab/base.py:RESTManager
| * | chore: add type hints to gitlab/base.py:RESTManagerJohn L. Villalovos2021-03-011-0/+5
| |/ | | | | | | Add some additional type hints to gitlab/base.py
* | Merge pull request #1350 from JohnVillalovos/jlvillal/isinstanceNejc Habjan2021-03-061-8/+15
|\ \ | |/ |/| chore: Put assert statements inside 'if TYPE_CHECKING:'
| * 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: del 'import *' in gitlab/v4/objects/project_access_tokens.pyJohn L. Villalovos2021-03-011-2/+2
|/ | | | | Remove usage of 'import *' in gitlab/v4/objects/project_access_tokens.py.
* chore: disallow incomplete type defsJohn L. Villalovos2021-02-284-31/+41
| | | | | | | | | | 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, ...]
* Merge pull request #1347 from python-gitlab/chore/split-repository-methodsMax Wittig2021-02-282-197/+208
|\ | | | | chore(api): move repository endpoints into separate module
| * chore(api): move repository endpoints into separate modulechore/split-repository-methodsNejc Habjan2021-02-282-197/+208
| |
* | Merge pull request #1343 from JohnVillalovos/jlvillal/mypy_testing_thingsNejc Habjan2021-02-281-4/+6
|\ \ | | | | | | chore: add and fix some type-hints in gitlab/client.py
| * | 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
* | | Merge pull request #1345 from JohnVillalovos/jlvillal/mypy_base_fixesNejc Habjan2021-02-281-1/+7
|\ \ \ | |_|/ |/| | chore: add additional type-hints for gitlab/base.py
| * | chore: add additional type-hints for gitlab/base.pyJohn L. Villalovos2021-02-271-1/+7
| |/ | | | | | | | | | | | | Add type-hints for the variables which are set via self.__dict__ mypy doesn't see them when they are assigned via self.__dict__. So declare them in the class definition.
* | Merge pull request #1333 from python-gitlab/feat/user-follow-apiNejc Habjan2021-02-283-0/+138
|\ \ | |/ |/| feat(users): add follow/unfollow API
| * feat(users): add follow/unfollow APIfeat/user-follow-apiMax Wittig2021-02-273-0/+138
| |
* | Merge pull request #1339 from JohnVillalovos/jlvillal/mypy_client_pyMax Wittig2021-02-272-79/+141
|\ \ | | | | | | chore: add type-hints to gitlab/client.py
| * | chore: add type-hints to gitlab/client.pyJohn L. Villalovos2021-02-262-79/+141
| | | | | | | | | | | | Adding some initial type-hints to gitlab/client.py
* | | chore: remove import of gitlab.utils from __init__.pyJohn L. Villalovos2021-02-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Initially when extracting out the gitlab/client.py code we tried to remove this but functional tests failed. Later we fixed the functional test that was failing, so now remove the unneeded import.
* | | chore: improve type-hints for gitlab/base.pyJohn L. Villalovos2021-02-261-3/+5
|/ / | | | | | | Determined the base class for obj_cls and adding type-hints for it.
* | Merge pull request #1334 from JohnVillalovos/jlvillal/mypy_cliNejc Habjan2021-02-261-8/+11
|\ \ | | | | | | chore: add type-hints to gitlab/cli.py
| * | chore: add type-hints to gitlab/cli.pyJohn L. Villalovos2021-02-251-8/+11
| | |
* | | fix: remove duplicate class definitions in v4/objects/users.pyJohn L. Villalovos2021-02-251-12/+0
|/ / | | | | | | | | The classes UserStatus and UserStatusManager were each declared twice. Remove the duplicate declarations.
* | Merge pull request #1329 from JohnVillalovos/jlvillal/mypy_constMax Wittig2021-02-251-30/+30
|\ \ | | | | | | Add type-hints to gitlab/const.py
| * | chore: add type-hints to gitlab/const.pyJohn L. Villalovos2021-02-251-30/+30
| | |
* | | Merge pull request #1330 from JohnVillalovos/jlvillal/mypy_utilsMax Wittig2021-02-251-6/+14
|\ \ \ | | | | | | | | chore: add type hints to gitlab/utils.py
| * | | chore: add type hints to gitlab/utils.pyJohn L. Villalovos2021-02-251-6/+14
| |/ /
* | | Merge pull request #1331 from JohnVillalovos/jlvillal/mypy_configMax Wittig2021-02-251-4/+7
|\ \ \ | | | | | | | | chore: add type-hints to gitlab/config.py
| * | | chore: add type-hints to gitlab/config.pyJohn L. Villalovos2021-02-251-4/+7
| |/ /
* | | fix: wrong variable nameJohn L. Villalovos2021-02-251-1/+1
|/ / | | | | | | | | Discovered this when I ran flake8 on the file. Unfortunately I was the one who introduced this wrong variable name :(
* | Merge pull request #1319 from JohnVillalovos/jlvillal/import_starNejc Habjan2021-02-2557-114/+244
|\ \ | |/ |/| chore: remove usage of 'from ... import *'
| * chore: remove usage of 'from ... import *'John L. Villalovos2021-02-2357-114/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In gitlab/v4/objects/*.py remove usage of: * from gitlab.base import * * from gitlab.mixins import * Change them to: * from gitlab.base import CLASS_NAME * from gitlab.mixins import CLASS_NAME Programmatically update code to explicitly import needed classes only. After the change the output of: $ flake8 gitlab/v4/objects/*py | grep 'REST\|Mixin' Is empty. Before many messages about unable to determine if it was a valid name.
* | test: don't add duplicate fixtureMax Wittig2021-02-241-26/+0
| | | | | | Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
* | feat(projects): add project access token apiMax Wittig2021-02-243-0/+159
|/
* fix: undefined name errorsJohn L. Villalovos2021-02-232-4/+8
| | | | Discovered that there were some undefined names.
* 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
* chore: add type hints to gitlab/base.pyJohn L. Villalovos2021-02-221-29/+34
|
* feat: add an initial mypy test to tox.iniJohn L. Villalovos2021-02-222-2/+2
| | | | 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-212-10/+29
| | | | | | | | | | | | | | | | | 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."
* chore(objects): make Project refreshableNejc Habjan2021-02-211-1/+1
| | | | Helps getting the real state of the project from the server.
* feat(objects): add Release Links API supportNejc Habjan2021-02-216-14/+180
|
* Merge pull request #1308 from Sineaggi/add-project-audit-endpointNejc Habjan2021-02-203-0/+104
|\ | | | | feat: add project audit endpoint
| * chore(tests): remove unused URL segmentNejc Habjan2021-02-201-2/+2
| |
| * feat: add project audit endpointClayton Walker2021-02-193-0/+104
| |
* | refactor: move Gitlab and GitlabList to gitlab/client.pyJohn L. Villalovos2021-02-183-834/+860
|/ | | | | | | | 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
* feat: add personal access token APIfeat/personal-access-token-apiMax Wittig2021-02-174-0/+66
| | | | See: https://docs.gitlab.com/ee/api/personal_access_tokens.html