Skip to content

Commit

Permalink
fix: use string to refer to type_checking symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
CaselIT committed Aug 12, 2024
1 parent c50f425 commit e3141c4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions falcon/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _before(responder_or_resource: _R) -> _R:
responder_or_resource, callable
):
if _DECORABLE_METHOD_NAME.match(responder_name):
responder = cast(Responder, responder)
responder = cast('Responder', responder)
do_before_all = _wrap_with_before(
responder, action, args, kwargs, is_async
)
Expand All @@ -177,7 +177,7 @@ def _before(responder_or_resource: _R) -> _R:
return cast(_R, responder_or_resource)

else:
responder = cast(Responder, responder_or_resource)
responder = cast('Responder', responder_or_resource)
do_before_one = _wrap_with_before(responder, action, args, kwargs, is_async)

return cast(_R, do_before_one)
Expand Down Expand Up @@ -226,7 +226,7 @@ def _after(responder_or_resource: _R) -> _R:
responder_or_resource, callable
):
if _DECORABLE_METHOD_NAME.match(responder_name):
responder = cast(Responder, responder)
responder = cast('Responder', responder)
do_after_all = _wrap_with_after(
responder, action, args, kwargs, is_async
)
Expand All @@ -236,7 +236,7 @@ def _after(responder_or_resource: _R) -> _R:
return cast(_R, responder_or_resource)

else:
responder = cast(Responder, responder_or_resource)
responder = cast('Responder', responder_or_resource)
do_after_one = _wrap_with_after(responder, action, args, kwargs, is_async)

return cast(_R, do_after_one)
Expand Down Expand Up @@ -282,7 +282,7 @@ def _wrap_with_after(
async_action = cast(AsyncAfterFn, _wrap_non_coroutine_unsafe(action))
else:
async_action = cast(AsyncAfterFn, action)
async_responder = cast(AsyncResponderMethod, responder)
async_responder = cast('AsyncResponderMethod', responder)

@wraps(async_responder)
async def do_after(
Expand All @@ -298,10 +298,10 @@ async def do_after(
await async_responder(self, req, resp, **kwargs)
await async_action(req, resp, self, *action_args, **action_kwargs)

do_after_responder = cast(AsyncResponderMethod, do_after)
do_after_responder = cast('AsyncResponderMethod', do_after)
else:
sync_action = cast(SyncAfterFn, action)
sync_responder = cast(SyncResponderMethod, responder)
sync_responder = cast('SyncResponderMethod', responder)

@wraps(sync_responder)
def do_after(
Expand All @@ -317,7 +317,7 @@ def do_after(
sync_responder(self, req, resp, **kwargs)
sync_action(req, resp, self, *action_args, **action_kwargs)

do_after_responder = cast(SyncResponderMethod, do_after)
do_after_responder = cast('SyncResponderMethod', do_after)
return do_after_responder


Expand Down Expand Up @@ -354,7 +354,7 @@ def _wrap_with_before(
async_action = cast(AsyncBeforeFn, _wrap_non_coroutine_unsafe(action))
else:
async_action = cast(AsyncBeforeFn, action)
async_responder = cast(AsyncResponderMethod, responder)
async_responder = cast('AsyncResponderMethod', responder)

@wraps(async_responder)
async def do_before(
Expand All @@ -370,10 +370,10 @@ async def do_before(
await async_action(req, resp, self, kwargs, *action_args, **action_kwargs)
await async_responder(self, req, resp, **kwargs)

do_before_responder = cast(AsyncResponderMethod, do_before)
do_before_responder = cast('AsyncResponderMethod', do_before)
else:
sync_action = cast(SyncBeforeFn, action)
sync_responder = cast(SyncResponderMethod, responder)
sync_responder = cast('SyncResponderMethod', responder)

@wraps(sync_responder)
def do_before(
Expand All @@ -389,7 +389,7 @@ def do_before(
sync_action(req, resp, self, kwargs, *action_args, **action_kwargs)
sync_responder(self, req, resp, **kwargs)

do_before_responder = cast(SyncResponderMethod, do_before)
do_before_responder = cast('SyncResponderMethod', do_before)
return do_before_responder


Expand Down

0 comments on commit e3141c4

Please sign in to comment.