Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 551 - 560 of 1,104 for Async (0.07 seconds)

  1. docs/tr/docs/advanced/events.md

    Dikkat edilmesi gereken ilk şey, `yield` içeren async bir fonksiyon tanımlıyor olmamız. Bu, `yield` kullanan Dependencies’e oldukça benzer.
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    Fonksiyonun `yield`’den önceki kısmı, uygulama başlamadan **önce** çalışır.
    
    `yield`’den sonraki kısım ise, uygulama işini bitirdikten **sonra** çalışır.
    
    ### Async Context Manager { #async-context-manager }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 8.3K bytes
    - Click Count (0)
  2. docs_src/dependencies/tutorial008_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends
    
    
    async def dependency_a():
        dep_a = generate_dep_a()
        try:
            yield dep_a
        finally:
            dep_a.close()
    
    
    async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]):
        dep_b = generate_dep_b()
        try:
            yield dep_b
        finally:
            dep_b.close(dep_a)
    
    
    async def dependency_c(dep_b: Annotated[DepB, Depends(dependency_b)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 521 bytes
    - Click Count (0)
  3. docs/zh-hant/docs/advanced/events.md

    ### Lifespan 函式 { #lifespan-function }
    
    首先要注意的是,我們定義了一個帶有 `yield` 的 async 函式。這和帶有 `yield` 的依賴(Dependencies)非常相似。
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    函式在 `yield` 之前的部分,會在應用啟動前先執行。
    
    `yield` 之後的部分,會在應用結束後再執行。
    
    ### 非同步內容管理器(Async Context Manager) { #async-context-manager }
    
    你會看到這個函式被 `@asynccontextmanager` 裝飾。
    
    它會把函式轉換成所謂的「**非同步內容管理器(async context manager)**」。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 7.2K bytes
    - Click Count (0)
  4. tests/test_response_change_status_code.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    async def response_status_setter(response: Response):
        response.status_code = 201
    
    
    async def parent_dep(result=Depends(response_status_setter)):
        return result
    
    
    @app.get("/", dependencies=[Depends(parent_dep)])
    async def get_main():
        return {"msg": "Hello World"}
    
    
    client = TestClient(app)
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Apr 08 04:37:38 GMT 2020
    - 589 bytes
    - Click Count (0)
  5. docs/pt/docs/advanced/stream-data.md

    ### Arquivos e async { #files-and-async }
    
    Na maioria dos casos, objetos semelhantes a arquivo não são compatíveis com async e await por padrão.
    
    Por exemplo, eles não têm `await file.read()`, nem `async for chunk in file`.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:13 GMT 2026
    - 5.7K bytes
    - Click Count (0)
  6. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http2/Http2Connection.kt

          }
    
        fun build(): Http2Connection = Http2Connection(this)
      }
    
      /**
       * Methods in this class must not lock FrameWriter. If a method needs to write a frame, create an
       * async task to do so.
       */
      inner class ReaderRunnable internal constructor(
        internal val reader: Http2Reader,
      ) : Http2Reader.Handler,
        () -> Unit {
        override fun invoke() {
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 31.9K bytes
    - Click Count (0)
  7. docs/es/docs/tutorial/stream-json-lines.md

    ///
    
    ### *path operation functions* no-async { #non-async-path-operation-functions }
    
    También puedes usar funciones `def` regulares (sin `async`), y usar `yield` de la misma forma.
    
    FastAPI se asegurará de que se ejecute correctamente para que no bloquee el event loop.
    
    Como en este caso la función no es async, el tipo de retorno correcto sería `Iterable[Item]`:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:12:26 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  8. docs/uk/docs/tutorial/request-files.md

        * Це особливо корисно, якщо ви виконаєте `await myfile.read()` один раз, а потім потрібно знову прочитати вміст.
    * `close()`: Закриває файл.
    
    Оскільки всі ці методи є асинхронними `async` методами, вам потрібно їх «await»-ити.
    
    Наприклад, всередині `async` *функції операції шляху* ви можете отримати вміст за допомогою:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 11K bytes
    - Click Count (0)
  9. docs_src/generate_clients/tutorial003_py310.py

    async def create_item(item: Item):
        return {"message": "Item received"}
    
    
    @app.get("/items/", response_model=list[Item], tags=["items"])
    async def get_items():
        return [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
        ]
    
    
    @app.post("/users/", response_model=ResponseMessage, tags=["users"])
    async def create_user(user: User):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 914 bytes
    - Click Count (0)
  10. docs/uk/docs/tutorial/stream-json-lines.md

    ///
    
    ### Не-async *функції операцій шляху* { #non-async-path-operation-functions }
    
    Ви також можете використовувати звичайні функції `def` (без `async`) і використовувати `yield` так само.
    
    FastAPI подбає про коректне виконання, щоб це не блокувало цикл подій.
    
    Оскільки в цьому випадку функція не є async, правильним типом повернення буде `Iterable[Item]`:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:25:54 GMT 2026
    - 6.6K bytes
    - Click Count (0)
Back to Top