[hvac] Clarify and improve some annotations (#13886)

This commit is contained in:
Semyon Moroz
2025-04-28 16:05:34 +04:00
committed by GitHub
parent 2d60b4bd9c
commit ba0976e6c5
3 changed files with 10 additions and 7 deletions
+3 -1
View File
@@ -1,9 +1,11 @@
import requests
class SigV4Auth:
access_key: str
secret_key: str
session_token: str | None
region: str
def __init__(self, access_key: str, secret_key: str, session_token: str | None = None, region: str = "us-east-1") -> None: ...
def add_auth(self, request) -> None: ...
def add_auth(self, request: requests.PreparedRequest) -> None: ...
def generate_sigv4_auth_request(header_value: str | None = None): ...
+3 -4
View File
@@ -1,9 +1,8 @@
from collections.abc import Iterable
from typing import Any
from typing_extensions import Self
class VaultError(Exception):
errors: Iterable[Any] | str | None
errors: Iterable[str] | str | None
method: str | None
url: str | None
text: str | None
@@ -11,7 +10,7 @@ class VaultError(Exception):
def __init__(
self,
message: str | None = None,
errors: Iterable[Any] | str | None = None,
errors: Iterable[str] | str | None = None,
method: str | None = None,
url: str | None = None,
text: str | None = None,
@@ -22,7 +21,7 @@ class VaultError(Exception):
cls,
status_code: int,
message: str | None = ...,
errors: Iterable[Any] | str | None = ...,
errors: Iterable[str] | str | None = ...,
method: str | None = ...,
url: str | None = ...,
text: str | None = ...,
+4 -2
View File
@@ -16,7 +16,7 @@ def raise_for_error(
url: str,
status_code: int,
message: str | None = None,
errors: Iterable[Any] | str | None = None,
errors: Iterable[str] | str | None = None,
text: str | None = None,
json: object | None = None,
) -> NoReturn: ...
@@ -42,4 +42,6 @@ def comma_delimited_to_list(list_param: Iterable[_T]) -> Iterable[_T]: ...
# the docstring states that this function returns a bool, but the code does not return anything
def validate_pem_format(param_name: str, param_argument: str) -> None: ...
def remove_nones(params: Mapping[_K, _V | None]) -> Mapping[_K, _V]: ...
def format_url(format_str: str, *args: Any, **kwargs: Any) -> str: ...
def format_url(
format_str: str, *args: object, **kwargs: object
) -> str: ... # values are passed to builtins.str, which takes an object type