-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Techdebt: Hide private decorator-methods/attributes (#7216)
- Loading branch information
Showing
7 changed files
with
128 additions
and
101 deletions.
There are no files selected for viewing
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
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,37 @@ | ||
from typing import TYPE_CHECKING, Callable, Optional, TypeVar, Union, overload | ||
|
||
from moto import settings | ||
from moto.core.config import DefaultConfig | ||
from moto.core.models import MockAWS, ProxyModeMockAWS, ServerModeMockAWS | ||
|
||
if TYPE_CHECKING: | ||
from typing_extensions import ParamSpec | ||
|
||
P = ParamSpec("P") | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
@overload | ||
def mock_aws(func: "Callable[P, T]") -> "Callable[P, T]": | ||
... | ||
|
||
|
||
@overload | ||
def mock_aws(func: None = None, config: Optional[DefaultConfig] = None) -> "MockAWS": | ||
... | ||
|
||
|
||
def mock_aws( | ||
func: "Optional[Callable[P, T]]" = None, | ||
config: Optional[DefaultConfig] = None, | ||
) -> Union["MockAWS", "Callable[P, T]"]: | ||
clss = ( | ||
ServerModeMockAWS | ||
if settings.TEST_SERVER_MODE | ||
else (ProxyModeMockAWS if settings.test_proxy_mode() else MockAWS) | ||
) | ||
if func is not None: | ||
return clss().__call__(func=func) | ||
else: | ||
return clss(config) |
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
Oops, something went wrong.