chore: applied all feedback

close: N25B-298
This commit is contained in:
Pim Hutting
2025-11-22 11:45:32 +01:00
parent 051f904576
commit c53307530b
12 changed files with 53 additions and 212 deletions

View File

@@ -7,13 +7,22 @@ class TimeBlock(object):
limit, or if no limit is given, the callback will be called with the time that the block took.
:param callback: The callback function that is called when the block of code is over,
unless the code block did not exceed the time limit.
unless the code block did not exceed the time limit.
:type callback: Callable[[float], None]
:param limit_ms: The number of milliseconds the block of code is allowed to take. If it
exceeds this time, or if it's None, the callback function will be called with the time the
block took.
exceeds this time, or if it's None, the callback function will be called with the time the
block took.
:type limit_ms: int | None
:ivar limit_ms: The number of milliseconds the block of code is allowed to take.
:vartype limit_ms: float | None
:ivar callback: The callback function that is called when the block of code is over.
:vartype callback: Callable[[float], None]
ivar start: The start time of the block, set when entering the context.
:vartype start: float | None
"""
def __init__(self, callback, limit_ms=None):
self.limit_ms = float(limit_ms) if limit_ms is not None else None