Download task_015/solution/code/example/example.py from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_015/solution/code/example/example.py
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_015/solution/code/example/example.py
-
curl -L -o example.py https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_015/solution/code/example/example.py
607 Bytes
| """Example usage of the pycron scheduler. | |
| This runnable example demonstrates the core features; see README.md for the | |
| full documentation and additional usage examples. | |
| """ | |
| import time | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from pycron import CronScheduler | |
| if __name__ == "__main__": | |
| scheduler = CronScheduler() | |
| counter = {"count": 0} | |
| scheduler.add_interval_job(0.05, lambda: counter.__setitem__("count", counter["count"] + 1)) | |
| scheduler.start() | |
| time.sleep(0.18) | |
| scheduler.stop() | |
| print(f"executions={counter['count']}") | |