Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1021 - 1030 of 1,169 for def2 (0.04 sec)

  1. scripts/playwright/query_param_models/image01.py

    import subprocess
    import time
    
    import httpx
    from playwright.sync_api import Playwright, sync_playwright
    
    
    # Run playwright codegen to generate the code below, copy paste the sections in run()
    def run(playwright: Playwright) -> None:
        browser = playwright.chromium.launch(headless=False)
        # Update the viewport manually
        context = browser.new_context(viewport={"width": 960, "height": 1080})
        browser = playwright.chromium.launch(headless=False)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Sep 17 18:54:10 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  2. docs_src/body_multiple_params/tutorial003_an_py39.py

        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        item_id: int, item: Item, user: User, importance: Annotated[int, Body()]
    ):
        results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 575 bytes
    - Viewed (0)
  3. docs_src/extra_data_types/tutorial001_an_py39.py

    from datetime import datetime, time, timedelta
    from typing import Annotated, Union
    from uuid import UUID
    
    from fastapi import Body, FastAPI
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def read_items(
        item_id: UUID,
        start_datetime: Annotated[datetime, Body()],
        end_datetime: Annotated[datetime, Body()],
        process_after: Annotated[timedelta, Body()],
        repeat_at: Annotated[Union[time, None], Body()] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Apr 19 00:11:40 UTC 2024
    - 801 bytes
    - Viewed (0)
  4. docs_src/additional_responses/tutorial002.py

        "/items/{item_id}",
        response_model=Item,
        responses={
            200: {
                "content": {"image/png": {}},
                "description": "Return the JSON item or an image.",
            }
        },
    )
    async def read_item(item_id: str, img: Union[bool, None] = None):
        if img:
            return FileResponse("image.png", media_type="image/png")
        else:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 628 bytes
    - Viewed (0)
  5. docs_src/body_fields/tutorial001_an_py310.py

        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: float | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]):
        results = {"item_id": item_id, "item": item}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 563 bytes
    - Viewed (0)
  6. docs_src/response_model/tutorial004.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 633 bytes
    - Viewed (0)
  7. build-logic/documentation/src/main/groovy/gradlebuild/docs/dsl/docbook/model/MethodDoc.groovy

            this.referringClass = referringClass
            id = "$referringClass.className:$metaData.overrideSignature"
            this.comment = comment
        }
    
        MethodDoc forClass(ClassDoc referringClass) {
            def refererMetaData = referringClass.classMetaData
            if (refererMetaData == this.referringClass) {
                return this
            }
            return new MethodDoc(refererMetaData, metaData, comment)
        }
    
    Registered: Wed Nov 06 11:36:14 UTC 2024
    - Last Modified: Wed Dec 09 08:14:05 UTC 2020
    - 2.3K bytes
    - Viewed (0)
  8. docs_src/body_multiple_params/tutorial004_an_py310.py

        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: Annotated[int, Body(gt=0)],
        q: str | None = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 643 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_background_tasks/test_tutorial002.py

    import os
    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.background_tasks.tutorial002 import app
    
    client = TestClient(app)
    
    
    def test():
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jul 09 18:06:12 UTC 2020
    - 568 bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/testing.md

    为你需要检查的地方用标准的Python表达式写个简单的 `assert` 语句(重申,标准的`pytest`)。
    
    ```Python hl_lines="2  12  15-18"
    {!../../docs_src/app_testing/tutorial001.py!}
    ```
    
    /// tip | "提示"
    
    注意测试函数是普通的 `def`,不是 `async def`。
    
    还有client的调用也是普通的调用,不是用 `await`。
    
    这让你可以直接使用 `pytest` 而不会遇到麻烦。
    
    ///
    
    /// note | "技术细节"
    
    你也可以用 `from starlette.testclient import TestClient`。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6K bytes
    - Viewed (0)
Back to top