Skip to content

Commit

Permalink
Add flush parameter to captured_request()
Browse files Browse the repository at this point in the history
It had just been forgotten.

Signed-off-by: David Plowman <[email protected]>
  • Loading branch information
davidplowman committed Jun 17, 2024
1 parent 07b3f23 commit 6f44aa8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion examples/request_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
with Picamera2() as picam2:
picam2.start()

for _ in range(50):
for _ in range(25):
with picam2.captured_request() as request:
print(request)
with picam2.captured_request(flush=True) as request:
print(request)
4 changes: 2 additions & 2 deletions picamera2/picamera2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,9 +1478,9 @@ def capture_request_and_stop_(self):
return self.dispatch_functions(functions, wait, signal_function, immediate=True)

@contextlib.contextmanager
def captured_request(self):
def captured_request(self, flush=None):
"""Capture a completed request using the context manager which guarantees its release."""
request = self.capture_request()
request = self.capture_request(flush=flush)
try:
yield request
finally:
Expand Down

0 comments on commit 6f44aa8

Please sign in to comment.