Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 91 - 100 of 1,100 for Fsync (0.09 seconds)

  1. fastapi/datastructures.py

    
        @app.post("/files/")
        async def create_file(file: Annotated[bytes, File()]):
            return {"file_size": len(file)}
    
    
        @app.post("/uploadfile/")
        async def create_upload_file(file: UploadFile):
            return {"filename": file.filename}
        ```
        """
    
        file: Annotated[
            BinaryIO,
            Doc("The standard Python file object (non-async)."),
        ]
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 5.2K bytes
    - Click Count (0)
  2. docs_src/stream_data/tutorial002_py310.py

        media_type = "image/png"
    
    
    @app.get("/image/stream", response_class=PNGStreamingResponse)
    async def stream_image() -> AsyncIterable[bytes]:
        with read_image() as image_file:
            for chunk in image_file:
                yield chunk
    
    
    @app.get("/image/stream-no-async", response_class=PNGStreamingResponse)
    def stream_image_no_async() -> Iterable[bytes]:
        with read_image() as image_file:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 20:51:40 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  3. tests/test_dependency_cache.py

    counter_holder = {"counter": 0}
    
    
    async def dep_counter():
        counter_holder["counter"] += 1
        return counter_holder["counter"]
    
    
    async def super_dep(count: int = Depends(dep_counter)):
        return count
    
    
    @app.get("/counter/")
    async def get_counter(count: int = Depends(dep_counter)):
        return {"counter": count}
    
    
    @app.get("/sub-counter/")
    async def get_sub_counter(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Aug 23 13:30:24 GMT 2022
    - 2.7K bytes
    - Click Count (0)
  4. cmd/lock-rest-server.go

    	lockRPCRUnlock     = newLockHandler(grid.HandlerLockRUnlock)
    )
    
    func newLockHandler(h grid.HandlerID) *grid.SingleHandler[*dsync.LockArgs, *dsync.LockResp] {
    	return grid.NewSingleHandler[*dsync.LockArgs, *dsync.LockResp](h, func() *dsync.LockArgs {
    		return &dsync.LockArgs{}
    	}, func() *dsync.LockResp {
    		return &dsync.LockResp{}
    	})
    }
    
    // registerLockRESTHandlers - register lock rest router.
    Created: Sun Apr 05 19:28:12 GMT 2026
    - Last Modified: Fri Jan 31 19:54:34 GMT 2025
    - 6.3K bytes
    - Click Count (0)
  5. tests/test_dependency_yield_scope_websockets.py

    ]
    
    app = FastAPI()
    
    
    @app.websocket("/function-scope")
    async def function_scope(websocket: WebSocket, session: SessionFuncDep) -> Any:
        await websocket.accept()
        await websocket.send_json({"is_open": session.open})
    
    
    @app.websocket("/request-scope")
    async def request_scope(websocket: WebSocket, session: SessionRequestDep) -> Any:
        await websocket.accept()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 6K bytes
    - Click Count (0)
  6. docs_src/stream_data/tutorial001_py310.py

    async def stream_story_no_annotation():
        for line in message.splitlines():
            yield line
    
    
    @app.get("/story/stream-no-async-no-annotation", response_class=StreamingResponse)
    def stream_story_no_async_no_annotation():
        for line in message.splitlines():
            yield line
    
    
    @app.get("/story/stream-bytes", response_class=StreamingResponse)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 2.2K bytes
    - Click Count (0)
  7. docs/de/docs/advanced/stream-data.md

    ### Dateien und Async { #files-and-async }
    
    In den meisten Fällen sind dateiähnliche Objekte standardmäßig nicht mit async und await kompatibel.
    
    Beispielsweise haben sie kein `await file.read()` oder `async for chunk in file`.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:48:21 GMT 2026
    - 6K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/advanced/stream-data.md

    在這個範例中因為是存在記憶體的假檔案(`io.BytesIO`),影響不大;但若是實際檔案,務必在處理完成後關閉檔案。
    
    ### 檔案與 Async { #files-and-async }
    
    多數情況下,類檔案物件預設不相容於 async/await。
    
    例如,它們沒有 `await file.read()`,也不支援 `async for chunk in file`。
    
    而且在許多情況下,讀取它們會是阻塞操作(可能阻塞事件迴圈),因為資料是從磁碟或網路讀取。
    
    /// info
    
    上面的範例其實是例外,因為 `io.BytesIO` 物件已在記憶體中,讀取不會阻塞任何東西。
    
    但在多數情況下,讀取檔案或類檔案物件會造成阻塞。
    
    ///
    
    為了避免阻塞事件迴圈,你可以將路徑操作函式宣告為一般的 `def`(而非 `async def`),這樣 FastAPI 會在 threadpool worker 上執行它,避免阻塞主事件迴圈。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.9K bytes
    - Click Count (0)
  9. docs_src/stream_json_lines/tutorial001_py310.py

    ]
    
    
    @app.get("/items/stream")
    async def stream_items() -> AsyncIterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-async")
    def stream_items_no_async() -> Iterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-annotation")
    async def stream_items_no_annotation():
        for item in items:
            yield item
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 936 bytes
    - Click Count (0)
  10. docs/en/docs/advanced/events.md

    The first thing to notice, is that we are defining an async function with `yield`. This is very similar to Dependencies with `yield`.
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    The first part of the function, before the `yield`, will be executed **before** the application starts.
    
    And the part after the `yield` will be executed **after** the application has finished.
    
    ### Async Context Manager { #async-context-manager }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 7.8K bytes
    - Click Count (0)
Back to Top