From ba0976e6c5547790f57b3da7afbbe91b4df11c17 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Mon, 28 Apr 2025 16:05:34 +0400 Subject: [PATCH] [hvac] Clarify and improve some annotations (#13886) --- stubs/hvac/hvac/aws_utils.pyi | 4 +++- stubs/hvac/hvac/exceptions.pyi | 7 +++---- stubs/hvac/hvac/utils.pyi | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stubs/hvac/hvac/aws_utils.pyi b/stubs/hvac/hvac/aws_utils.pyi index 134fd4b2f..a63a1b022 100644 --- a/stubs/hvac/hvac/aws_utils.pyi +++ b/stubs/hvac/hvac/aws_utils.pyi @@ -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): ... diff --git a/stubs/hvac/hvac/exceptions.pyi b/stubs/hvac/hvac/exceptions.pyi index 9bf16de09..67c2ed53b 100644 --- a/stubs/hvac/hvac/exceptions.pyi +++ b/stubs/hvac/hvac/exceptions.pyi @@ -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 = ..., diff --git a/stubs/hvac/hvac/utils.pyi b/stubs/hvac/hvac/utils.pyi index 75e86eb61..5eaf5803b 100644 --- a/stubs/hvac/hvac/utils.pyi +++ b/stubs/hvac/hvac/utils.pyi @@ -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