Skip to content

Commit ba0976e

Browse files
authored
[hvac] Clarify and improve some annotations (#13886)
1 parent 2d60b4b commit ba0976e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

stubs/hvac/hvac/aws_utils.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import requests
2+
13
class SigV4Auth:
24
access_key: str
35
secret_key: str
46
session_token: str | None
57
region: str
68
def __init__(self, access_key: str, secret_key: str, session_token: str | None = None, region: str = "us-east-1") -> None: ...
7-
def add_auth(self, request) -> None: ...
9+
def add_auth(self, request: requests.PreparedRequest) -> None: ...
810

911
def generate_sigv4_auth_request(header_value: str | None = None): ...

stubs/hvac/hvac/exceptions.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from collections.abc import Iterable
2-
from typing import Any
32
from typing_extensions import Self
43

54
class VaultError(Exception):
6-
errors: Iterable[Any] | str | None
5+
errors: Iterable[str] | str | None
76
method: str | None
87
url: str | None
98
text: str | None
109
json: object
1110
def __init__(
1211
self,
1312
message: str | None = None,
14-
errors: Iterable[Any] | str | None = None,
13+
errors: Iterable[str] | str | None = None,
1514
method: str | None = None,
1615
url: str | None = None,
1716
text: str | None = None,
@@ -22,7 +21,7 @@ class VaultError(Exception):
2221
cls,
2322
status_code: int,
2423
message: str | None = ...,
25-
errors: Iterable[Any] | str | None = ...,
24+
errors: Iterable[str] | str | None = ...,
2625
method: str | None = ...,
2726
url: str | None = ...,
2827
text: str | None = ...,

stubs/hvac/hvac/utils.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def raise_for_error(
1616
url: str,
1717
status_code: int,
1818
message: str | None = None,
19-
errors: Iterable[Any] | str | None = None,
19+
errors: Iterable[str] | str | None = None,
2020
text: str | None = None,
2121
json: object | None = None,
2222
) -> NoReturn: ...
@@ -42,4 +42,6 @@ def comma_delimited_to_list(list_param: Iterable[_T]) -> Iterable[_T]: ...
4242
# the docstring states that this function returns a bool, but the code does not return anything
4343
def validate_pem_format(param_name: str, param_argument: str) -> None: ...
4444
def remove_nones(params: Mapping[_K, _V | None]) -> Mapping[_K, _V]: ...
45-
def format_url(format_str: str, *args: Any, **kwargs: Any) -> str: ...
45+
def format_url(
46+
format_str: str, *args: object, **kwargs: object
47+
) -> str: ... # values are passed to builtins.str, which takes an object type

0 commit comments

Comments
 (0)