Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Specific type hints#2067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

vectro
Copy link

Update the type hints on Mixin objects to be more specific so that clients can know the specific RESTObject that would be returned.

Closes#2062

@nejch
Copy link
Member

Hi@vectro. thanks for the earlier discussions and for looking into this. We usetox to manage our environments and versions so you can use that before pushing to make sure all the test & lint jobs succeed consistently with the versions we track.

https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst#running-unit-tests

One of these is a commitlint check as we parse commits to create changelogs so this might need a bit of a squash andamend once it's ready for review 🙇

@vectro
Copy link
Author

@nejch I ran tox and see some errors that I'm not sure what to do with. What do you think?

  • At gitlab/v4/cli.py:352 related to SidekiqManager but I'm not really sure what that class should look like. Should it even have an _obj_cls attribute?
  • At tests/meta/test_mro.py:122 because Generic is now the final class in the MRO (I suppose) and not RESTManager.
  • cz is unhappy but presumably that can be resolved by squashing commits.

@nejch
Copy link
Member

@vectro sorry for the super late response! I haven't checked this in depth myself but a few pointers:

I'm not sure your code gets checked by mypy as expected, as the generics part is defined outside theif TYPE_CHECKING block - unless I'm misunderstanding something here:

ifTYPE_CHECKING:
# When running mypy we use these as the base classes
_RestManagerBase=base.RESTManager
_RestObjectBase=base.RESTObject
else:
class_RestManagerBase(Generic[T_obj,T_parent]):
_obj_cls:Type[T_obj]
_parent:Optional[T_parent]
class_RestObjectBase(Generic[T_obj,T_parent]):
_obj_cls:Type[T_obj]
_parent:Optional[T_parent]

Also keep in mind@JohnVillalovos did some work on typing recently so that might affect your rebase here.

@github-actions
Copy link

This Pull Request (PR) was marked stale because it has been open 90 days with no activity. Please remove the stale label or comment on this PR. Otherwise, it will be closed in 15 days.

@github-actions
Copy link

This PR was closed because it has been marked stale for 15 days with no activity. If this PR is still valid, please re-open.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees

@vectrovectro

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Type hint on ListMixin.list is too strict
3 participants
@vectro@nejch@JohnVillalovos

[8]ページ先頭

©2009-2025 Movatter.jp