Search Options

Results per page
Sort
Preferred Languages
Advance

Results 281 - 290 of 1,072 for Str (0.02 sec)

  1. docs_src/separate_openapi_schemas/tutorial002.py

    from typing import List, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
    
    
    app = FastAPI(separate_input_output_schemas=False)
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> List[Item]:
        return [
            Item(
                name="Portal Gun",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 524 bytes
    - Viewed (0)
  2. docs_src/query_params/tutorial004.py

    from typing import Union
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/users/{user_id}/items/{item_id}")
    async def read_user_item(
        user_id: int, item_id: str, q: Union[str, None] = None, short: bool = False
    ):
        item = {"item_id": item_id, "owner_id": user_id}
        if q:
            item.update({"q": q})
        if not short:
            item.update(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 468 bytes
    - Viewed (0)
  3. docs_src/settings/app03_an_py39/config.py

    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
        class Config:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 204 bytes
    - Viewed (0)
  4. docs_src/body_nested_models/tutorial007_py39.py

    app = FastAPI()
    
    
    class Image(BaseModel):
        url: HttpUrl
        name: str
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
        images: Union[list[Image], None] = None
    
    
    class Offer(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        items: list[Item]
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 570 bytes
    - Viewed (0)
  5. docs_src/settings/app03_an/config.py

    from pydantic_settings import BaseSettings, SettingsConfigDict
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 235 bytes
    - Viewed (0)
  6. docs_src/schema_extra_example/tutorial001_pv1.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
        class Config:
            schema_extra = {
                "examples": [
                    {
                        "name": "Foo",
                        "description": "A very nice Item",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 669 bytes
    - Viewed (0)
  7. docs_src/schema_extra_example/tutorial003_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        item_id: int,
        item: Annotated[
            Item,
            Body(
                examples=[
                    {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 692 bytes
    - Viewed (0)
  8. tensorflow/c/eager/c_api_experimental.cc

          tensorflow::unwrap(ctx)->HostCPUParsedName());
      auto str = tensorflow::DeviceNameUtils::ParsedNameToString(address_space);
      void* data = tensorflow::port::Malloc(str.length());
      str.copy(static_cast<char*>(data), str.length(), 0);
      buf->data = data;
      buf->length = str.length();
      buf->data_deallocator = [](void* data, size_t length) {
        tensorflow::port::Free(data);
      };
    }
    Registered: Tue Nov 05 12:39:12 UTC 2024
    - Last Modified: Sat Oct 12 05:11:17 UTC 2024
    - 35.9K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/dependencies/sub-dependencies.md

    ```Python hl_lines="1"
    async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
        return {"fresh_value": fresh_value}
    ```
    
    ////
    
    //// tab | Python 3.8+ non-Annotated
    
    /// tip
    
    Prefer to use the `Annotated` version if possible.
    
    ///
    
    ```Python hl_lines="1"
    async def needy_dependency(fresh_value: str = Depends(get_value, use_cache=False)):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.5K bytes
    - Viewed (0)
  10. docs_src/body_fields/tutorial001_py310.py

    from fastapi import Body, FastAPI
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = Field(
            default=None, title="The description of the item", max_length=300
        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: float | None = None
    
    
    @app.put("/items/{item_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 523 bytes
    - Viewed (0)
Back to top