- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 22 for Suplee (0.87 sec)
-
tests/test_typing_python39.py
@needs_py310 def test_typing(): types = { list[int]: [1, 2, 3], dict[str, list[int]]: {"a": [1, 2, 3], "b": [4, 5, 6]}, set[int]: [1, 2, 3], # `set` is converted to `list` tuple[int, ...]: [1, 2, 3], # `tuple` is converted to `list` } for test_type, expect in types.items(): app = FastAPI() @app.post("/", response_model=test_type) def post_endpoint(input: test_type):
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 709 bytes - Viewed (0) -
docs/zh/docs/tutorial/response-model.md
``` !!! tip `{"name", "description"}` 语法创建一个具有这两个值的 `set`。 等同于 `set(["name", "description"])`。 #### 使用 `list` 而不是 `set` 如果你忘记使用 `set` 而是使用 `list` 或 `tuple`,FastAPI 仍会将其转换为 `set` 并且正常工作: ```Python hl_lines="31 37" {!../../../docs_src/response_model/tutorial006.py!} ``` ## 总结 使用*路径操作装饰器*的 `response_model` 参数来定义响应模型,特别是确保私有数据被过滤掉。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 7.9K bytes - Viewed (0) -
docs/ja/docs/tutorial/response-model.md
``` !!! tip "豆知識" `{"name", "description"}`の構文はこれら2つの値をもつ`set`を作成します。 これは`set(["name", "description"])`と同等です。 #### `set`の代わりに`list`を使用する もし`set`を使用することを忘れて、代わりに`list`や`tuple`を使用しても、FastAPIはそれを`set`に変換して正しく動作します: ```Python hl_lines="31 37" {!../../../docs_src/response_model/tutorial006.py!} ``` ## まとめ
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.3K bytes - Viewed (0) -
fastapi/dependencies/models.py
# Store the path to be able to re-generate a dependable from it in overrides self.path = path # Save the cache key at creation to optimize performance
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 2.4K bytes - Viewed (0) -
tests/test_invalid_path_param.py
from typing import Dict, List, Tuple import pytest from fastapi import FastAPI from pydantic import BaseModel def test_invalid_sequence(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/{id}") def read_items(id: List[Item]): pass # pragma: no cover def test_invalid_tuple():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Jun 03 17:59:40 GMT 2019 - 1.7K bytes - Viewed (0) -
tests/test_invalid_sequence_param.py
import pytest from fastapi import FastAPI, Query from pydantic import BaseModel def test_invalid_sequence(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/") def read_items(q: List[Item] = Query(default=None)): pass # pragma: no cover def test_invalid_tuple():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 1.2K bytes - Viewed (0) -
tests/test_dependency_security_overrides.py
from typing import List, Tuple from fastapi import Depends, FastAPI, Security from fastapi.security import SecurityScopes from fastapi.testclient import TestClient app = FastAPI() def get_user(required_scopes: SecurityScopes): return "john", required_scopes.scopes def get_user_override(required_scopes: SecurityScopes): return "alice", required_scopes.scopes def get_data(): return [1, 2, 3]
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Jun 14 15:54:46 GMT 2020 - 1.4K bytes - Viewed (0) -
docs/ko/docs/tutorial/body-nested-models.md
### typing의 `List` 임포트 먼저, 파이썬 표준 `typing` 모듈에서 `List`를 임포트합니다: ```Python hl_lines="1" {!../../../docs_src/body_nested_models/tutorial002.py!} ``` ### 타입 매개변수로 `List` 선언 `list`, `dict`, `tuple`과 같은 타입 매개변수(내부 타입)를 갖는 타입을 선언하려면: * `typing` 모듈에서 임포트 * 대괄호를 사용하여 "타입 매개변수"로 내부 타입 전달: `[` 및 `]` ```Python from typing import List my_list: List[str] ``` 이 모든 것은 타입 선언을 위한 표준 파이썬 문법입니다.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 7.6K bytes - Viewed (0) -
docs/en/docs/tutorial/body-nested-models.md
```Python hl_lines="1" {!> ../../../docs_src/body_nested_models/tutorial002.py!} ``` ### Declare a `list` with a type parameter To declare types that have type parameters (internal types), like `list`, `dict`, `tuple`: * If you are in a Python version lower than 3.9, import their equivalent version from the `typing` module * Pass the internal type(s) as "type parameters" using square brackets: `[` and `]` In Python 3.9 it would be:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.5K bytes - Viewed (0) -
tests/test_forms_from_non_typing_sequences.py
def post_form_param_list(items: list = Form()): return items @app.post("/form/python-set") def post_form_param_set(items: set = Form()): return items @app.post("/form/python-tuple") def post_form_param_tuple(items: tuple = Form()): return items client = TestClient(app) def test_python_list_param_as_form(): response = client.post(
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 1.2K bytes - Viewed (0)