Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 221 - 230 of 1,705 for nonce (0.17 seconds)

  1. docs/en/docs/advanced/advanced-python-types.md

    ```python
    from typing import Union
    
    
    def say_hi(name: Union[str, None]):
            print(f"Hi {name}!")
    ```
    
    `typing` also has a shortcut to declare that something could be `None`, with `Optional`.
    
    Here's a tip from my very **subjective** point of view:
    
    * 🚨 Avoid using `Optional[SomeType]`
    * Instead ✨ **use `Union[SomeType, None]`** ✨.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:32:12 GMT 2026
    - 2K bytes
    - Click Count (0)
  2. docs_src/body/tutorial004_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, q: str | None = None):
        result = {"item_id": item_id, **item.model_dump()}
        if q:
            result.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 414 bytes
    - Click Count (0)
  3. .mailmap

    Paul Merlin <******@****.***> <******@****.***>
    Peter Niederwieser <******@****.***> <pniederw@.(none)>
    Peter Niederwieser <******@****.***> <pniederw@pniederw-PC.(none)>
    Piotr Jagielski <******@****.***> <Piotr Jagielski>
    Rene Groeschke <******@****.***> <Rene@DevWin7.(none)>
    Rene Groeschke <******@****.***> <******@****.***>
    Rene Groeschke <******@****.***> <******@****.***>
    Created: Wed Apr 01 11:36:16 GMT 2026
    - Last Modified: Tue Oct 03 06:34:28 GMT 2017
    - 3.3K bytes
    - Click Count (0)
  4. docs_src/body_nested_models/tutorial005_py310.py

    app = FastAPI()
    
    
    class Image(BaseModel):
        url: HttpUrl
        name: str
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
        image: Image | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 468 bytes
    - Click Count (0)
  5. docs_src/body_multiple_params/tutorial003_py310.py

    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    class User(BaseModel):
        username: str
        full_name: str | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, user: User, importance: int = Body()):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 504 bytes
    - Click Count (0)
  6. fastapi/encoders.py

            return str(obj)
        if isinstance(obj, (str, int, float, type(None))):
            return obj
        if isinstance(obj, PydanticUndefinedType):
            return None
        if isinstance(obj, dict):
            encoded_dict = {}
            allowed_keys = set(obj.keys())
            if include is not None:
                allowed_keys &= set(include)
            if exclude is not None:
                allowed_keys -= set(exclude)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 10.9K bytes
    - Click Count (0)
  7. docs/ja/docs/tutorial/query-params-str-validations.md

    こぎ場合īŧˆ`Annotated` をäŊŋわãĒい場合īŧ‰ã€é–ĸ数内ぎデフりãƒĢト値 `None` を `Query()` ãĢįŊŽãæ›ãˆã‚‹åŋ…čĻãŒã‚ã‚‹ãŸã‚ã€`Query(default=None)` ãŽãƒ‘ãƒŠãƒĄãƒŧã‚ŋでデフりãƒĢãƒˆå€¤ã‚’č¨­åŽšã™ã‚‹åŋ…čĻãŒã‚ã‚Šãžã™ã€‚ã“ã‚Œã¯īŧˆå°‘ãĒくとも FastAPI ãĢã¨ãŖãĻはīŧ‰ããŽãƒ‡ãƒ•りãƒĢãƒˆå€¤ã‚’åŽšįžŠã™ã‚‹ãŽã¨åŒã˜į›Žįš„ã‚’æžœãŸã—ãžã™ã€‚
    
    ãĒぎで:
    
    ```Python
    q: str | None = Query(default=None)
    ```
    
    ...はデフりãƒĢト値 `None` を持つã‚Ēãƒ—ã‚ˇãƒ§ãƒŠãƒĢãĒãƒ‘ãƒŠãƒĄãƒŧã‚ŋãĢãĒり、äģĨ下と同じです:
    
    
    ```Python
    q: str | None = None
    ```
    
    ただし `Query` ぎバãƒŧã‚¸ãƒ§ãƒŗã§ã¯ã€ã‚¯ã‚¨ãƒĒãƒ‘ãƒŠãƒĄãƒŧã‚ŋであることを明į¤ēįš„ãĢåŽŖč¨€ã—ãĻいぞす。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 20.3K bytes
    - Click Count (0)
  8. scripts/docs.py

    
    def get_lang_paths() -> list[Path]:
        return sorted(docs_path.iterdir())
    
    
    def lang_callback(lang: str | None) -> str | None:
        if lang is None:
            return None
        lang = lang.lower()
        return lang
    
    
    def complete_existing_lang(incomplete: str):
        lang_path: Path
        for lang_path in get_lang_paths():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 17:46:10 GMT 2026
    - 25.4K bytes
    - Click Count (0)
  9. tests/test_enforce_once_required_parameter.py

        return f"{client_id}_key"
    
    
    def _get_client_tag(client_id: str | None = Query(None)) -> str | None:
        if client_id is None:
            return None
        return f"{client_id}_tag"
    
    
    @app.get("/foo")
    def foo_handler(
        client_key: str = Depends(_get_client_key),
        client_tag: str | None = Depends(_get_client_tag),
    ):
        return {"client_id": client_key, "client_tag": client_tag}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  10. tests/test_dependency_class.py

    
    class CallableGenDependency:
        def __call__(self, value: str) -> Generator[str, None, None]:
            yield value
    
    
    class AsyncCallableDependency:
        async def __call__(self, value: str) -> str:
            return value
    
    
    class AsyncCallableGenDependency:
        async def __call__(self, value: str) -> AsyncGenerator[str, None]:
            yield value
    
    
    class MethodsDependency:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 4.4K bytes
    - Click Count (0)
Back to Top