Skip to content

[python-jenkins] Improve get_jobs and get_all_jobs return type #14547

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

roberfi
Copy link

@roberfi roberfi commented Aug 8, 2025

Fixes #14538

This comment has been minimized.

@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Mapping, MutableMapping, Sequence
from re import Pattern
from typing import Any, Final, Literal, overload
from typing import Any, Final, Literal, TypedDict, overload
Copy link
Contributor

@donBarbos donBarbos Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Suggested change
from typing import Any, Final, Literal, TypedDict, overload
from typing import Any, Final, Literal, TypedDict, overload, type_check_only

@roberfi roberfi force-pushed the python-jenkins-get-jobs branch from 844784f to 3c985d7 Compare August 8, 2025 11:48
_class: str
url: str
color: str
name: str
Copy link
Contributor

@donBarbos donBarbos Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fullname attribute was missing, moreover it seems required like name
but I can't say for sure that it is required :)

Suggested change
name: str
name: Required[str]
fullname: Required[str]

@donBarbos
Copy link
Contributor

As a quick note, squash commits aren’t the recommended approach.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Aug 8, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Member

@brianschubert brianschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good, just one remark about the TypedDict keys

Comment on lines +98 to +99
url: str
color: str
Copy link
Member

@brianschubert brianschubert Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the docs say

Each job is a dictionary with ‘name’, ‘url’, ‘color’ and ‘fullname’ keys.

I think url and color can be made required as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

python-jenkins stubs: get_jobs() and get_all_jobs() functions annotations are wrong
3 participants