Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 184 for yielded (0.04 sec)

  1. docs_src/dependencies/tutorial013_an_py310.py

    
    def get_session():
        with Session(engine) as session:
            yield session
    
    
    def get_user(user_id: int, session: Annotated[Session, Depends(get_session)]):
        user = session.get(User, user_id)
        if not user:
            raise HTTPException(status_code=403, detail="Not authorized")
    
    
    def generate_stream(query: str):
        for ch in query:
            yield ch
            time.sleep(0.1)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 937 bytes
    - Viewed (0)
  2. docs/ko/docs/advanced/events.md

    새로운 버전을 시작해야 하거나, 그냥 실행을 멈추고 싶을 수도 있습니다. 🤷
    
    ///
    
    ### Lifespan 함수
    
    먼저 주목할 점은, `yield`를 사용하여 비동기 함수(async function)를 정의하고 있다는 것입니다. 이는 `yield`를 사용한 의존성과 매우 유사합니다.
    
    {* ../../docs_src/events/tutorial003.py hl[14:19] *}
    
    함수의 첫 번째 부분, 즉 `yield` 이전의 코드는 애플리케이션이 시작되기 **전에** 실행됩니다.
    
    그리고 `yield` 이후의 부분은 애플리케이션이 완료된 후 **나중에** 실행됩니다.
    
    ### 비동기 컨텍스트 매니저
    
    함수를 확인해보면, `@asynccontextmanager`로 장식되어 있습니다.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  3. 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)
  4. docs_src/dependencies/tutorial010_py39.py

        def __enter__(self):
            return self.db
    
        def __exit__(self, exc_type, exc_value, traceback):
            self.db.close()
    
    
    async def get_db():
        with MySuperContextManager() as db:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 292 bytes
    - Viewed (0)
  5. docs_src/custom_response/tutorial007_py39.py

    from fastapi import FastAPI
    from fastapi.responses import StreamingResponse
    
    app = FastAPI()
    
    
    async def fake_video_streamer():
        for i in range(10):
            yield b"some fake video bytes"
    
    
    @app.get("/")
    async def main():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 277 bytes
    - Viewed (0)
  6. tests/test_dependency_yield_scope_websockets.py

    
    class Session:
        def __init__(self) -> None:
            self.open = True
    
    
    async def dep_session() -> Any:
        s = Session()
        yield s
        s.open = False
        global_state = global_context.get()
        global_state["session_closed"] = True
    
    
    SessionFuncDep = Annotated[Session, Depends(dep_session, scope="function")]
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6K bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial008e_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    def get_username():
        try:
            yield "Rick"
        finally:
            print("Cleanup up before response is sent")
    
    
    @app.get("/users/me")
    def get_user_me(username: Annotated[str, Depends(get_username, scope="function")]):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 03 10:12:49 UTC 2025
    - 329 bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial007_py39.py

    async def get_db():
        db = DBSession()
        try:
            yield db
        finally:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 99 bytes
    - Viewed (0)
  9. src/main/java/org/codelibs/fess/helper/CrawlingConfigHelper.java

                        yield webConfigService.getWebConfig(id).get();
                    }
                    case FILE -> {
                        final FileConfigService fileConfigService = ComponentUtil.getComponent(FileConfigService.class);
                        yield fileConfigService.getFileConfig(id).get();
                    }
                    case DATA -> {
    Registered: Sat Dec 20 09:19:18 UTC 2025
    - Last Modified: Fri Nov 28 16:29:12 UTC 2025
    - 19.5K bytes
    - Viewed (1)
  10. docs_src/custom_response/tutorial008_py39.py

    some_file_path = "large-video-file.mp4"
    app = FastAPI()
    
    
    @app.get("/")
    def main():
        def iterfile():  # (1)
            with open(some_file_path, mode="rb") as file_like:  # (2)
                yield from file_like  # (3)
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 360 bytes
    - Viewed (0)
Back to top