diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-02-29 00:37:27 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-02-29 00:48:33 +0300 |
commit | 2012d1699e811928e206c0296cd577bab470a8e3 (patch) | |
tree | 06136f2245026d22c169413d3f2ca73cc31ddc3d /contrib/python/responses | |
parent | 8beeba02645591e571028bc75de25e84bc47bad9 (diff) | |
download | ydb-2012d1699e811928e206c0296cd577bab470a8e3.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/responses')
-rw-r--r-- | contrib/python/responses/py3/.dist-info/METADATA | 4 | ||||
-rw-r--r-- | contrib/python/responses/py3/README.rst | 1 | ||||
-rw-r--r-- | contrib/python/responses/py3/responses/matchers.py | 27 | ||||
-rw-r--r-- | contrib/python/responses/py3/ya.make | 2 |
4 files changed, 19 insertions, 15 deletions
diff --git a/contrib/python/responses/py3/.dist-info/METADATA b/contrib/python/responses/py3/.dist-info/METADATA index 6daec58b17..c658b29065 100644 --- a/contrib/python/responses/py3/.dist-info/METADATA +++ b/contrib/python/responses/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: responses -Version: 0.24.1 +Version: 0.25.0 Summary: A utility library for mocking out the `requests` Python library. Home-page: https://github.com/getsentry/responses Author: David Cramer @@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Software Development Requires-Python: >=3.8 Description-Content-Type: text/x-rst @@ -1273,6 +1274,7 @@ If you are using the ``Retry`` features of ``urllib3`` and want to cover scenari import responses from responses import registries + from urllib3.util import Retry @responses.activate(registry=registries.OrderedRegistry) diff --git a/contrib/python/responses/py3/README.rst b/contrib/python/responses/py3/README.rst index e2096c6cae..9b255076b7 100644 --- a/contrib/python/responses/py3/README.rst +++ b/contrib/python/responses/py3/README.rst @@ -1232,6 +1232,7 @@ If you are using the ``Retry`` features of ``urllib3`` and want to cover scenari import responses from responses import registries + from urllib3.util import Retry @responses.activate(registry=registries.OrderedRegistry) diff --git a/contrib/python/responses/py3/responses/matchers.py b/contrib/python/responses/py3/responses/matchers.py index 78980fe307..20af1be693 100644 --- a/contrib/python/responses/py3/responses/matchers.py +++ b/contrib/python/responses/py3/responses/matchers.py @@ -4,8 +4,9 @@ import re from json.decoder import JSONDecodeError from typing import Any from typing import Callable -from typing import Dict from typing import List +from typing import Mapping +from typing import MutableMapping from typing import Optional from typing import Pattern from typing import Tuple @@ -17,7 +18,7 @@ from requests import PreparedRequest from urllib3.util.url import parse_url -def _create_key_val_str(input_dict: Union[Dict[Any, Any], Any]) -> str: +def _create_key_val_str(input_dict: Union[Mapping[Any, Any], Any]) -> str: """ Returns string of format {'key': val, 'key2': val2} Function is called recursively for nested dictionaries @@ -57,8 +58,8 @@ def _create_key_val_str(input_dict: Union[Dict[Any, Any], Any]) -> str: def _filter_dict_recursively( - dict1: Dict[Any, Any], dict2: Dict[Any, Any] -) -> Dict[Any, Any]: + dict1: Mapping[Any, Any], dict2: Mapping[Any, Any] +) -> Mapping[Any, Any]: filtered_dict = {} for k, val in dict1.items(): if k in dict2: @@ -70,7 +71,7 @@ def _filter_dict_recursively( def urlencoded_params_matcher( - params: Optional[Dict[str, str]], *, allow_blank: bool = False + params: Optional[Mapping[str, str]], *, allow_blank: bool = False ) -> Callable[..., Any]: """ Matches URL encoded data @@ -100,7 +101,7 @@ def urlencoded_params_matcher( def json_params_matcher( - params: Optional[Union[Dict[str, Any], List[Any]]], *, strict_match: bool = True + params: Optional[Union[Mapping[str, Any], List[Any]]], *, strict_match: bool = True ) -> Callable[..., Any]: """Matches JSON encoded data of request body. @@ -192,7 +193,7 @@ def fragment_identifier_matcher(identifier: Optional[str]) -> Callable[..., Any] def query_param_matcher( - params: Optional[Dict[str, Any]], *, strict_match: bool = True + params: Optional[MutableMapping[str, Any]], *, strict_match: bool = True ) -> Callable[..., Any]: """Matcher to match 'params' argument in request. @@ -276,7 +277,7 @@ def query_string_matcher(query: Optional[str]) -> Callable[..., Any]: return match -def request_kwargs_matcher(kwargs: Optional[Dict[str, Any]]) -> Callable[..., Any]: +def request_kwargs_matcher(kwargs: Optional[Mapping[str, Any]]) -> Callable[..., Any]: """ Matcher to match keyword arguments provided to request @@ -308,7 +309,7 @@ def request_kwargs_matcher(kwargs: Optional[Dict[str, Any]]) -> Callable[..., An def multipart_matcher( - files: Dict[str, Any], data: Optional[Dict[str, str]] = None + files: Mapping[str, Any], data: Optional[Mapping[str, str]] = None ) -> Callable[..., Any]: """ Matcher to match 'multipart/form-data' content-type. @@ -392,7 +393,7 @@ def multipart_matcher( def header_matcher( - headers: Dict[str, Union[str, Pattern[str]]], strict_match: bool = False + headers: Mapping[str, Union[str, Pattern[str]]], strict_match: bool = False ) -> Callable[..., Any]: """ Matcher to match 'headers' argument in request using the responses library. @@ -408,7 +409,7 @@ def header_matcher( :return: (func) matcher """ - def _compare_with_regex(request_headers: Union[Dict[Any, Any], Any]) -> bool: + def _compare_with_regex(request_headers: Union[Mapping[Any, Any], Any]) -> bool: if strict_match and len(request_headers) != len(headers): return False @@ -420,13 +421,13 @@ def header_matcher( else: if not v == request_headers[k]: return False - elif strict_match: + else: return False return True def match(request: PreparedRequest) -> Tuple[bool, str]: - request_headers: Union[Dict[Any, Any], Any] = request.headers or {} + request_headers: Union[Mapping[Any, Any], Any] = request.headers or {} if not strict_match: # filter down to just the headers specified in the matcher diff --git a/contrib/python/responses/py3/ya.make b/contrib/python/responses/py3/ya.make index 4a0969de93..ffa133acdf 100644 --- a/contrib/python/responses/py3/ya.make +++ b/contrib/python/responses/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.24.1) +VERSION(0.25.0) LICENSE(Apache-2.0) |