Search Options

Results per page
Sort
Preferred Languages
Advance

Results 421 - 430 of 781 for typing (0.03 sec)

  1. tests/test_request_params/test_body/test_optional_list.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import Body, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-list-str", operation_id="optional_list_str")
    async def read_optional_list_str(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 12.7K bytes
    - Viewed (0)
  2. docs/zh/docs/python-types.md

    
    ### 嵌套类型
    
    有些容器数据结构可以包含其他的值,比如 `dict`、`list`、`set` 和 `tuple`。它们内部的值也会拥有自己的类型。
    
    你可以使用 Python 的 `typing` 标准库来声明这些类型以及子类型。
    
    它专门用来支持这些类型提示。
    
    #### 列表
    
    例如,让我们来定义一个由 `str` 组成的 `list` 变量。
    
    从 `typing` 模块导入 `List`(注意是大写的 `L`):
    
    {* ../../docs_src/python_types/tutorial006.py hl[1] *}
    
    
    同样以冒号(`:`)来声明这个变量。
    
    输入 `List` 作为类型。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Aug 18 06:34:40 UTC 2025
    - 8.6K bytes
    - Viewed (0)
  3. fastapi/openapi/docs.py

    import json
    from typing import Annotated, Any, Optional
    
    from annotated_doc import Doc
    from fastapi.encoders import jsonable_encoder
    from starlette.responses import HTMLResponse
    
    swagger_ui_default_parameters: Annotated[
        dict[str, Any],
        Doc(
            """
            Default configurations for Swagger UI.
    
            You can use it as a template to add any other configurations needed.
            """
        ),
    ] = {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 10.1K bytes
    - Viewed (0)
  4. fastapi/security/api_key.py

    from typing import Annotated, Optional, Union
    
    from annotated_doc import Doc
    from fastapi.openapi.models import APIKey, APIKeyIn
    from fastapi.security.base import SecurityBase
    from starlette.exceptions import HTTPException
    from starlette.requests import Request
    from starlette.status import HTTP_401_UNAUTHORIZED
    
    
    class APIKeyBase(SecurityBase):
        def __init__(
            self,
            location: APIKeyIn,
            name: str,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 9.6K bytes
    - Viewed (1)
  5. scripts/people.py

    import logging
    import secrets
    import subprocess
    import time
    from collections import Counter
    from collections.abc import Container
    from datetime import datetime, timedelta, timezone
    from pathlib import Path
    from typing import Any, Union
    
    import httpx
    import yaml
    from github import Github
    from pydantic import BaseModel, SecretStr
    from pydantic_settings import BaseSettings
    
    github_graphql_url = "https://api.github.com/graphql"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 12.3K bytes
    - Viewed (0)
  6. tests/test_schema_extra_examples.py

    from typing import Union
    
    import pytest
    from fastapi import Body, Cookie, FastAPI, Header, Path, Query
    from fastapi.exceptions import FastAPIDeprecationWarning
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict
    
    
    def create_app():
        app = FastAPI()
    
        class Item(BaseModel):
            data: str
    
            model_config = ConfigDict(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 32.2K bytes
    - Viewed (0)
  7. tests/test_request_params/test_query/test_optional_str.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import FastAPI, Query
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/optional-str")
    async def read_optional_str(p: Optional[str] = None):
        return {"p": p}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8.1K bytes
    - Viewed (0)
  8. docs/de/docs/features.md

    Wenn Sie eine zweiminütige Auffrischung benötigen, wie man Python-Typen verwendet (auch wenn Sie FastAPI nicht benutzen), schauen Sie sich das kurze Tutorial an: [Einführung in Python-Typen](python-types.md){.internal-link target=_blank}.
    
    Sie schreiben Standard-Python mit Typen:
    
    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 10.9K bytes
    - Viewed (0)
  9. docs/ko/docs/python-types.md

    ### 타입 매개변수를 활용한 Generic(제네릭) 타입
    
    `dict`, `list`, `set`, `tuple`과 같은 값을 저장할 수 있는 데이터 구조가 있고, 내부의 값은 각자의 타입을 가질 수도 있습니다.
    
    타입과 내부 타입을 선언하기 위해서는 파이썬 표준 모듈인 `typing`을 이용해야 합니다.
    
    구체적으로는 아래 타입 힌트를 지원합니다.
    
    #### `List`
    
    예를 들면, `str`의 `list`인 변수를 정의해봅시다.
    
    `typing`에서  `List`(대문자 `L`)를 import 합니다.
    
    {* ../../docs_src/python_types/tutorial006.py hl[1] *}
    
    
    콜론(`:`) 문법을 이용하여 변수를 선언합니다.
    
    타입으로는 `List`를 넣어줍니다.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  10. tests/test_request_params/test_cookie/test_required_str.py

    from typing import Annotated
    
    import pytest
    from dirty_equals import IsOneOf
    from fastapi import Cookie, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/required-str")
    async def read_required_str(p: Annotated[str, Cookie()]):
        return {"p": p}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.2K bytes
    - Viewed (0)
Back to top