-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from _typeshed import Incomplete | ||
from collections.abc import Mapping, MutableMapping, Sequence | ||
from re import Pattern | ||
from typing import Any, Final, Literal, overload | ||
from typing_extensions import TypeAlias, deprecated | ||
from typing import Any, Final, Literal, TypedDict, overload, type_check_only | ||
from typing_extensions import Required, TypeAlias, deprecated | ||
|
||
import requests | ||
from requests.models import Request, Response | ||
|
@@ -92,6 +92,15 @@ class WrappedSession(requests.Session): | |
_JSONValue: TypeAlias = Any # too many possibilities to express | ||
_JSON: TypeAlias = dict[str, _JSONValue] | ||
|
||
@type_check_only | ||
class _Job(TypedDict, total=False): | ||
_class: str | ||
url: str | ||
color: str | ||
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering the docs say
I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that it could be true for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Besides, I also observe in my example that @type_check_only
class _Job(TypedDict, total=False):
_class: Required[str]
url: Required[str]
color: str
name: Required[str]
fullname: Required[str]
jobs: list[_Job] What do you think? |
||
name: Required[str] | ||
fullname: Required[str] | ||
jobs: list[_Job] | ||
|
||
class Jenkins: | ||
server: str | ||
auth: _Auth | None | ||
|
@@ -128,10 +137,8 @@ class Jenkins: | |
def get_plugins_info(self, depth: int = 2) -> _JSON: ... | ||
def get_plugin_info(self, name: str, depth: int = 2) -> _JSON: ... | ||
def get_plugins(self, depth: int = 2) -> _JSON: ... | ||
def get_jobs( | ||
self, folder_depth: int = 0, folder_depth_per_request: int = 10, view_name: str | None = None | ||
) -> list[dict[str, str]]: ... | ||
def get_all_jobs(self, folder_depth: int | None = None, folder_depth_per_request: int = 10) -> list[dict[str, str]]: ... | ||
def get_jobs(self, folder_depth: int = 0, folder_depth_per_request: int = 10, view_name: str | None = None) -> list[_Job]: ... | ||
def get_all_jobs(self, folder_depth: int | None = None, folder_depth_per_request: int = 10) -> list[_Job]: ... | ||
def copy_job(self, from_name: str, to_name: str) -> None: ... | ||
def rename_job(self, from_name: str, to_name: str) -> None: ... | ||
def delete_job(self, name: str) -> None: ... | ||
|
Uh oh!
There was an error while loading. Please reload this page.