Skip to content

Commit

Permalink
Rename _SomethingCallableLike -> _CallableLike
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed Dec 23, 2024
1 parent 1c31f11 commit 69efd3e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions server-utils/server_utils/fastapi_utils/light_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
_P = typing.ParamSpec("_P")
_ReturnT = typing.TypeVar("_ReturnT")

# `_SomethingCallableLike(FastAPI.foo)` produces a callable with the same signature
# `_CallableLike(FastAPI.foo)` produces a callable with the same signature
# as `FastAPI.foo()`.
class _SomethingCallableLike(typing.Generic[_P, _ReturnT]):
class _CallableLike(typing.Generic[_P, _ReturnT]):
def __init__(
self,
method_to_mimic: typing.Callable[
Expand All @@ -49,14 +49,14 @@ def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _ReturnT:
raise NotImplementedError("This is only for type-checking, not runtime.")

class _FastAPIRouteMethods:
get: typing.Final = _SomethingCallableLike(fastapi.FastAPI.get)
put: typing.Final = _SomethingCallableLike(fastapi.FastAPI.put)
post: typing.Final = _SomethingCallableLike(fastapi.FastAPI.post)
delete: typing.Final = _SomethingCallableLike(fastapi.FastAPI.delete)
options: typing.Final = _SomethingCallableLike(fastapi.FastAPI.options)
head: typing.Final = _SomethingCallableLike(fastapi.FastAPI.head)
patch: typing.Final = _SomethingCallableLike(fastapi.FastAPI.patch)
trace: typing.Final = _SomethingCallableLike(fastapi.FastAPI.trace)
get: typing.Final = _CallableLike(fastapi.FastAPI.get)
put: typing.Final = _CallableLike(fastapi.FastAPI.put)
post: typing.Final = _CallableLike(fastapi.FastAPI.post)
delete: typing.Final = _CallableLike(fastapi.FastAPI.delete)
options: typing.Final = _CallableLike(fastapi.FastAPI.options)
head: typing.Final = _CallableLike(fastapi.FastAPI.head)
patch: typing.Final = _CallableLike(fastapi.FastAPI.patch)
trace: typing.Final = _CallableLike(fastapi.FastAPI.trace)

else:

Expand Down

0 comments on commit 69efd3e

Please sign in to comment.