-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(typing): expose public TypeAliases for type intended for librar…
…y users
- Loading branch information
1 parent
f84703f
commit 5aa8038
Showing
7 changed files
with
140 additions
and
75 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
releasenotes/notes/public-type-aliases-f389506932adfa2c.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
features: | ||
- | | ||
Exposes some public type aliases (for type hinting only, they can't be instanciated) | ||
for the types intended to be used by `requests_mock` users. | ||
The following types are now exposed: | ||
- `requests_mock.Context` used in callbacks | ||
- `requests_mock.Request` used in callbacks, which is a `requests.PreparedRequest` proxy. | ||
- `requests_mock.Callback[T]` which is the callbacks type. | ||
fixes: | ||
- | | ||
Some typing inconsistencies have been fixed. | ||
Especially for `request` object in signatures which is in fact a `requests_mock.Request` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
# Stubs for requests_mock | ||
|
||
from requests_mock.adapter import ANY as ANY, Adapter as Adapter | ||
from requests_mock.exceptions import MockException as MockException, NoMockAddress as NoMockAddress | ||
from requests_mock.mocker import DELETE as DELETE, GET as GET, HEAD as HEAD, Mocker as Mocker, MockerCore as MockerCore, OPTIONS as OPTIONS, PATCH as PATCH, POST as POST, PUT as PUT, mock as mock | ||
from requests_mock.request import _RequestObjectProxy as _RequestObjectProxy | ||
from requests_mock.response import CookieJar as CookieJar, create_response as create_response | ||
from requests_mock.adapter import ( | ||
ANY as ANY, | ||
Adapter as Adapter, | ||
Callback as Callback, | ||
AdditionalMatcher as AdditionalMatcher, | ||
) | ||
from requests_mock.exceptions import ( | ||
MockException as MockException, | ||
NoMockAddress as NoMockAddress, | ||
) | ||
from requests_mock.mocker import ( | ||
DELETE as DELETE, | ||
GET as GET, | ||
HEAD as HEAD, | ||
Mocker as Mocker, | ||
MockerCore as MockerCore, | ||
OPTIONS as OPTIONS, | ||
PATCH as PATCH, | ||
POST as POST, | ||
PUT as PUT, | ||
mock as mock, | ||
) | ||
from requests_mock.request import ( | ||
Request as Request, | ||
_RequestObjectProxy as _RequestObjectProxy, # For backward compatibility | ||
) | ||
from requests_mock.response import ( | ||
CookieJar as CookieJar, | ||
create_response as create_response, | ||
Context as Context, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
from typing import Literal, Optional, Union | ||
|
||
|
||
_case_type = Optional[str] | ||
_case_default = Union[Literal['false'], Literal[False]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters