Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
nap.py
Go to the documentation of this file.
1# Copyright 2016 Étienne Bersac
2# Copyright 2016 Julien Danjou
3# Copyright 2016 Joshua Harlow
4# Copyright 2013-2014 Ray Holder
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18import time
19import typing
20
22 import threading
23
24
25def sleep(seconds: float) -> None:
26 """
27 Sleep strategy that delays execution for a given number of seconds.
28
29 This is the default strategy, and may be mocked out for unit testing.
30 """
31 time.sleep(seconds)
32
33
35 """Sleep strategy that waits on an event to be set."""
36
37 def __init__(self, event: "threading.Event") -> None:
38 self.event = event
39
40 def __call__(self, timeout: typing.Optional[float]) -> None:
41 # NOTE(harlowja): this may *not* actually wait for timeout
42 # seconds if the event is set (ie this may eject out early).
43 self.event.wait(timeout=timeout)
None __call__(self, typing.Optional[float] timeout)
Definition nap.py:40
None __init__(self, "threading.Event" event)
Definition nap.py:37
for i