Skip to content

New Ruff failure #365

@rwb27

Description

@rwb27

Ruff (in our unpinned tests) flags a new warning:

error[ASYNC119]: Yield in context manager in async generator may not trigger cleanup
   --> src/labthings_fastapi/outputs/mjpeg_stream.py:292:21
    |
290 |                 i = await self.next_frame()
291 |                 async with self.buffer_for_reading(i) as frame:
292 |                     yield frame
    |                     ^^^^^^^^^^^
293 |             except StopAsyncIteration:
294 |                 break
    |
help: Use `@asynccontextmanager` if appropriate, or refactor

This is not an @asynccontextmanager and shouldn't be: I guess it probably is the case that we may want to consider refactoring.

To be honest, the buffer-retention mechanism doesn't serve much purpose so we might be better off just simplifying the stream code, but either way it probably wants looking at.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions