Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for yielded (0.06 sec)

  1. docs/en/docs/release-notes.md

    Using resources from dependencies with `yield` in background tasks is no longer supported.
    
    This change is what supports the new features, read below. 🤓
    
    ### Dependencies with `yield`, `HTTPException` and Background Tasks
    
    Dependencies with `yield` now can raise `HTTPException` and other exceptions after `yield`. 🎉
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_static_files/test_tutorial001.py

        sample_file = static_dir / "sample.txt"
        sample_file.write_text("This is a sample static file.")
        from docs_src.static_files.tutorial001_py39 import app
    
        with TestClient(app) as client:
            yield client
        sample_file.unlink()
        static_dir.rmdir()
    
    
    def test_static_files(client: TestClient):
        response = client.get("/static/sample.txt")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  3. scripts/translate.py

            Path("docs/en/docs/advanced"),
            Path("docs/en/docs/about"),
            Path("docs/en/docs/how-to"),
        ]
        first_parent = Path("docs/en/docs")
        yield from first_parent.glob("*.md")
        for dir_path in first_dirs:
            yield from dir_path.rglob("*.md")
        first_dirs_str = tuple(str(d) for d in first_dirs)
        for path in Path("docs/en/docs").rglob("*.md"):
            if str(path).startswith(first_dirs_str):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:05:53 UTC 2025
    - 34.1K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_sql_databases/test_tutorial001.py

        mod.sqlite_url = "sqlite://"
        mod.engine = create_engine(
            mod.sqlite_url, connect_args={"check_same_thread": False}, poolclass=StaticPool
        )
    
        with TestClient(mod.app) as c:
            yield c
        # Clean up connection explicitly to avoid resource warning
        mod.engine.dispose()
    
    
    def test_crud_app(client: TestClient):
        # TODO: this warns that SQLModel.from_orm is deprecated in Pydantic v1, refactor
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 14K bytes
    - Viewed (0)
  5. tests/benchmarks/test_general_performance.py

    ):
        return ItemOut(name="foo", value=123, dep=dep)
    
    
    @pytest.fixture(scope="module")
    def client() -> Iterator[TestClient]:
        with TestClient(app) as client:
            yield client
    
    
    def _bench_get(benchmark, client: TestClient, path: str) -> tuple[int, bytes]:
        warmup = client.get(path)
        assert warmup.status_code == 200
    
        def do_request() -> tuple[int, bytes]:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 20:40:26 UTC 2025
    - 11.1K bytes
    - Viewed (0)
  6. fastapi/param_functions.py

            Union[Literal["function", "request"], None],
            Doc(
                """
                Mainly for dependencies with `yield`, define when the dependency function
                should start (the code before `yield`) and when it should end (the code
                after `yield`).
    
                * `"function"`: start the dependency before the *path operation function*
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 63K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_sql_databases/test_tutorial002.py

        mod.sqlite_url = "sqlite://"
        mod.engine = create_engine(
            mod.sqlite_url, connect_args={"check_same_thread": False}, poolclass=StaticPool
        )
    
        with TestClient(mod.app) as c:
            yield c
        # Clean up connection explicitly to avoid resource warning
        mod.engine.dispose()
    
    
    def test_crud_app(client: TestClient):
        # TODO: this warns that SQLModel.from_orm is deprecated in Pydantic v1, refactor
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 17.9K bytes
    - Viewed (0)
  8. fastapi/openapi/models.py

        from pydantic import EmailStr
    except ImportError:  # pragma: no cover
    
        class EmailStr(str):  # type: ignore
            @classmethod
            def __get_validators__(cls) -> Iterable[Callable[..., Any]]:
                yield cls.validate
    
            @classmethod
            def validate(cls, v: Any) -> str:
                logger.warning(
                    "email-validator not installed, email fields will be treated as str.\n"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  9. fastapi/routing.py

                        "application code is raising an exception and a dependency with yield "
                        "has a block with a bare except, or a block with except Exception, "
                        "and is not raising the exception again. Read more about it in the "
                        "docs: https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-except"
                    )
    
            # Same as in Starlette
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 174.6K bytes
    - Viewed (0)
  10. scripts/docs.py

        return lang
    
    
    def complete_existing_lang(incomplete: str):
        lang_path: Path
        for lang_path in get_lang_paths():
            if lang_path.is_dir() and lang_path.name.startswith(incomplete):
                yield lang_path.name
    
    
    @app.callback()
    def callback() -> None:
        # For MacOS with Cairo
        os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib"
    
    
    @app.command()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Dec 21 17:40:17 UTC 2025
    - 16.9K bytes
    - Viewed (0)
Back to top