| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a query returns more than 10,000 records than the following values
are NOT returned:
x.total_pages
x.total
Modify the code to allow no value to be set for these values. If there
is not a value returned the functions will now return None.
Update unit test so no longer `xfail`
https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers
Closes #1686
|
|\
| |
| | |
docs: only use type annotations for documentation
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A commonly reported issue from users on Gitter is that they get an
AttributeError for an attribute that should be present. This is often
caused due to the fact that they used the `list()` method to retrieve
the object and objects retrieved this way often only have a subset of
the full data.
Add more details in the AttributeError message that explains the
situation to users. This will hopefully allow them to resolve the
issue.
Update the FAQ in the docs to add a section discussing the issue.
Closes #1138
|
|
|
|
|
|
|
|
|
|
|
|
| |
When attempting to add type-hints to the the 'manager' attribute into
a RESTObject derived class it would break things.
This was because our auto-manager creation code would automatically
add the specified annotated manager to the 'manager' attribute. This
breaks things.
Now check in our auto-manager creation if our attribute is called
'manager'. If so we ignore it.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are small typos in:
- docs/gl_objects/deploy_tokens.rst
- gitlab/base.py
- gitlab/mixins.py
- gitlab/v4/objects/features.py
- gitlab/v4/objects/groups.py
- gitlab/v4/objects/packages.py
- gitlab/v4/objects/projects.py
- gitlab/v4/objects/sidekiq.py
- gitlab/v4/objects/todos.py
Fixes:
- Should read `treatment` rather than `reatment`.
- Should read `transferred` rather than `transfered`.
- Should read `registered` rather than `registred`.
- Should read `occurred` rather than `occured`.
- Should read `overridden` rather than `overriden`.
- Should read `marked` rather than `maked`.
- Should read `instantiate` rather than `instanciate`.
- Should read `function` rather than `fonction`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Convert our manager usage to be done via type annotations.
Now to define a manager to be used in a RESTObject subclass can simply
do:
class ExampleClass(CRUDMixin, RESTObject):
my_manager: MyManager
Any type-annotation that annotates it to be of type *Manager (with the
exception of RESTManager) will cause the manager to be created on the
object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 'managers' are dynamically created. This unfortunately means that
we don't have any type-hints for them and so editors which understand
type-hints won't know that they are valid attributes.
* Add the type-hints for the managers we define.
* Add a unit test that makes sure that the type-hints and the
'_managers' attribute are kept in sync with each other.
* Add unit test that makes sure specified managers in '_managers'
have a name ending in 'Managers' to keep with current convention.
* Make RESTObject._managers always present with a default value of
None.
* Fix a type-issue revealed now that mypy knows what the type is
|
|
|
|
|
|
|
|
| |
Sometimes we have errors where we don't get a dictionary passed to
RESTObject.__init__() method. This breaks things but in confusing
ways.
Check in the __init__() method and raise an exception if it occurs.
|
|
|
|
|
|
| |
Fix the import ordering using isort.
https://pycqa.github.io/isort/
|
|
|
|
|
|
|
|
|
| |
Be more strict and don't allow untyped definitions on the files we
check.
Also this adds type-hints for two of the decorators so that now
functions/methods decorated by them will have their types be revealed
correctly.
|
|
|
|
|
|
|
|
| |
Always create RESTObject._short_print_attrs with a default value of
None.
This way we don't need to use hasattr() and we will know the type of
the attribute.
|
|\
| |
| | |
fix(types): prevent __dir__ in RestObject from producing duplicates
|
| | |
|
|/
|
|
|
|
| |
Convert _create_attrs and _update_attrs to use a NamedTuple
(RequiredOptional) to help with code readability. Update all code to
use the NamedTuple.
|
|
|
|
|
|
|
| |
Add the attributes: _create_attrs and _update_attrs to the RESTManager
class. This is so that we stop using getattr() if we don't need to.
This also helps with type-hints being available for these attributes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to commit 3727cbd21fc40b312573ca8da56e0f6cf9577d08
RESTManager._from_parent_attrs did not exist unless it was explicitly
set. But commit 3727cbd21fc40b312573ca8da56e0f6cf9577d08 set it to a
default value of {}.
So the checks using hasattr() were no longer valid.
Update the checks to check if RESTManager._from_parent_attrs has a
value.
|
|
|
|
|
|
|
|
|
|
| |
We now create _types = {} in RESTManager class.
By making _types always present in RESTManager it makes the code
simpler. We no longer have to do:
types = getattr(self, "_types", {})
And the type checker now understands the type.
|
|
|
|
| |
Add some additional type hints to gitlab/base.py
|
|
|
|
|
|
|
|
|
|
| |
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, ...]
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
chore: add type-hints to gitlab/client.py
|
| |
| |
| |
| | |
Adding some initial type-hints to gitlab/client.py
|
|/
|
|
| |
Determined the base class for obj_cls and adding type-hints for it.
|
| |
|
| |
|
|
|
|
|
|
| |
This fixes and error, where deleted attributes would not show up
Fixes #1155
|
| |
|
|
|
|
| |
Co-Authored-By: Nejc Habjan <hab.nejc@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
To ease lists and sets manipulations.
|
|
|
|
| |
Drop the code, the tests, and update the documentation.
|
|
|
|
|
|
|
| |
This might happen in CLI context, where recursion to discover parent
attributes is not required (URL gets hardcoded)
Fix should fix the CLI CI.
|
|
|
|
|
|
|
|
| |
Make gitlab objects serializable
With current implementation of API v3 and v4 support, some instances
have properties of type module and are not serializable. Handle
these properties manually with setstate and getstate methods.
|
|
|
|
|
|
|
| |
Expose the X-* pagination attributes returned by the Gitlab server when
requesting lists.
Closes #304
|
|
|
|
|
|
| |
In v3 we create objects from json dicts when it makes sense. Support for
this feature has not been kept in v4, and we didn't get requests for it
so let's drop the _constructor_types definitions.
|
|
|
|
| |
Fixes #306
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Some things are probably broken. Next step is writting unit and
functional tests.
And fix.
|