Skip to content

Commit

Permalink
typing: additional improvements and clanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CaselIT committed Aug 14, 2024
1 parent b781e73 commit 16e1e7a
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 65 deletions.
16 changes: 12 additions & 4 deletions falcon/asgi/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from falcon.constants import SINGLETON_HEADERS
from falcon.forwarded import Forwarded
from falcon.typing import AsgiReceive
from falcon.typing import StoreArgument
from falcon.util import deprecated
from falcon.util import ETag
from falcon.util.uri import parse_host
Expand Down Expand Up @@ -785,7 +786,7 @@ def get_param(
self,
name: str,
required: Literal[True],
store: Optional[Dict[str, str]] = ...,
store: StoreArgument = ...,
default: Optional[str] = ...,
) -> str: ...

Expand All @@ -794,7 +795,7 @@ def get_param(
self,
name: str,
required: bool = ...,
store: Optional[Dict[str, Any]] = ...,
store: StoreArgument = ...,
*,
default: str = ...,
) -> str: ...
Expand All @@ -804,15 +805,15 @@ def get_param(
self,
name: str,
required: bool = False,
store: Optional[Dict[str, Any]] = None,
store: StoreArgument = None,
default: Optional[str] = None,
) -> Optional[str]: ...

def get_param(
self,
name: str,
required: bool = False,
store: Optional[Dict[str, Any]] = None,
store: StoreArgument = None,
default: Optional[str] = None,
) -> Optional[str]:
"""Return the raw value of a query string parameter as a string.
Expand Down Expand Up @@ -863,6 +864,13 @@ def get_param(

return super().get_param(name, required=required, store=store, default=default)

@property
def env(self) -> NoReturn: # type:ignore[override]
"""The env property is not available in ASGI. Use :attr:`~.store` instead"""
raise AttributeError(
'The env property is not available in ASGI. Use :attr:`~.store` instead'
)

def log_error(self, message: str) -> NoReturn:
"""Write a message to the server's log.
Expand Down
5 changes: 0 additions & 5 deletions falcon/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2790,8 +2790,3 @@ def _parse_retry_after(
else:
headers['Retry-After'] = str(retry_after)
return headers


MediaError = Union[
MediaNotFoundError, MediaValidationError, MediaValidationError, MultipartParseError
]
Loading

0 comments on commit 16e1e7a

Please sign in to comment.