- Sort Score
- Num 10 results
- Language All
Results 171 - 180 of 1,131 for defs (0.03 seconds)
-
docs/uk/docs/async.md
```Python hl_lines="1" async def get_burgers(number: int): # Виконайте деякі асинхронні дії, щоб створити бургери return burgers ``` ...замість `def`: ```Python hl_lines="2" # Це не асинхронно def get_sequential_burgers(number: int): # Виконайте деякі послідовні дії, щоб створити бургери
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 36.6K bytes - Click Count (0) -
fastapi/utils.py
return operation_id def generate_unique_id(route: "APIRoute") -> str: operation_id = f"{route.name}{route.path_format}" operation_id = re.sub(r"\W", "_", operation_id) assert route.methods operation_id = f"{operation_id}_{list(route.methods)[0].lower()}" return operation_id def deep_dict_update(main_dict: dict[Any, Any], update_dict: dict[Any, Any]) -> None:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 11 18:41:21 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/fr/docs/tutorial/cors.md
Ainsi, toutes celles-ci sont des origines différentes : * `http://localhost` * `https://localhost` * `http://localhost:8080` Même si elles sont toutes sur `localhost`, elles utilisent des protocoles ou des ports différents, ce sont donc des « origines » différentes. ## Étapes { #steps }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:37:13 GMT 2026 - 6.1K bytes - Click Count (0) -
docs/zh-hant/docs/async.md
同樣適用於[依賴項](tutorial/dependencies/index.md)。如果依賴項是一個標準的 `def` 函式,而不是 `async def`,那麼它在外部的執行緒池被運行。 ### 子依賴項 { #sub-dependencies } 你可以擁有多個相互依賴的依賴項和[子依賴項](tutorial/dependencies/sub-dependencies.md)(作為函式定義的參數),其中一些可能是用 `async def` 宣告,也可能是用 `def` 宣告。它們仍然可以正常運作,用 `def` 定義的那些將會在外部的執行緒中呼叫(來自執行緒池),而不是被「等待」。 ### 其他輔助函式 { #other-utility-functions } 你可以直接呼叫任何使用 `def` 或 `async def` 建立的其他輔助函式,FastAPI 不會影響你呼叫它們的方式。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 21.7K bytes - Click Count (0) -
docs/zh/docs/async.md
这同样适用于[依赖](tutorial/dependencies/index.md)。如果一个依赖是标准的 `def` 函数而不是 `async def`,它将被运行在外部线程池中。 ### 子依赖 { #sub-dependencies } 你可以拥有多个相互依赖的依赖以及[子依赖](tutorial/dependencies/sub-dependencies.md) (作为函数的参数),它们中的一些可能是通过 `async def` 声明,也可能是通过 `def` 声明。它们仍然可以正常工作,这些通过 `def` 声明的函数将会在外部线程中调用(来自线程池),而不是"被等待"。 ### 其他函数 { #other-utility-functions } 你可直接调用通过 `def` 或 `async def` 创建的任何其他函数,FastAPI 不会影响你调用它们的方式。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 21.6K bytes - Click Count (0) -
tests/test_annotated.py
@app.get("/default") async def default(foo: Annotated[str, Query()] = "foo"): return {"foo": foo} @app.get("/required") async def required(foo: Annotated[str, Query(min_length=1)]): return {"foo": foo} @app.get("/multiple") async def multiple(foo: Annotated[str, object(), Query(min_length=1)]): return {"foo": foo} @app.get("/unrelated") async def unrelated(foo: Annotated[str, object()]):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 10.5K bytes - Click Count (0) -
tests/test_response_model_data_filter_no_inheritance.py
name: str owner: UserDB class PetOut(BaseModel): name: str owner: User @app.post("/users/", response_model=User) async def create_user(user: UserCreate): return user @app.get("/pets/{pet_id}", response_model=PetOut) async def read_pet(pet_id: int): user = UserDB( email="******@****.***", hashed_password="secrethashed", )Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 1.7K bytes - Click Count (0) -
docs_src/stream_data/tutorial002_py310.py
binary_image = base64.b64decode(image_base64) def read_image() -> BytesIO: return BytesIO(binary_image) app = FastAPI() class PNGStreamingResponse(StreamingResponse): media_type = "image/png" @app.get("/image/stream", response_class=PNGStreamingResponse) async def stream_image() -> AsyncIterable[bytes]: with read_image() as image_file:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 20:51:40 GMT 2026 - 5.6K bytes - Click Count (0) -
tests/test_repeated_cookie_headers.py
app = FastAPI() def set_cookie(*, response: Response): response.set_cookie("cookie-name", "cookie-value") return {} def set_indirect_cookie(*, dep: str = Depends(set_cookie)): return dep @app.get("/directCookie") def get_direct_cookie(dep: str = Depends(set_cookie)): return {"dep": dep} @app.get("/indirectCookie")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Jun 13 12:44:51 GMT 2020 - 792 bytes - Click Count (0) -
tests/test_inherited_custom_class.py
from fastapi.testclient import TestClient from pydantic import BaseModel class MyUuid: def __init__(self, uuid_string: str): self.uuid = uuid_string def __str__(self): return self.uuid @property # type: ignore def __class__(self): return uuid.UUID @property def __dict__(self): """Spoof a missing __dict__ by raising TypeError, this is howCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 1.8K bytes - Click Count (0)