summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2022-01-02 15:25:38 +0200
committerAlex Grönholm <alex.gronholm@nextday.fi>2022-01-02 15:25:38 +0200
commita0e1647117225b10e3ee96f9a895ecf2fea40eaf (patch)
tree216cba565b7fb9d1e0ecc49cb3bce6c99dc73fb9 /examples
parentab8c32e0a925b6dff2974f32f645c839cdb000e0 (diff)
downloadapscheduler-a0e1647117225b10e3ee96f9a895ecf2fea40eaf.tar.gz
Upgraded syntax and switched linting over to pre-commit.ci
Linting checks are now run by pre-commit.ci instead of GitHub Actions.
Diffstat (limited to 'examples')
-rw-r--r--examples/executors/processpool.py6
-rw-r--r--examples/misc/reference.py5
-rw-r--r--examples/rpc/client.py3
-rw-r--r--examples/rpc/server.py2
-rw-r--r--examples/schedulers/async_.py3
-rw-r--r--examples/schedulers/sync.py2
6 files changed, 16 insertions, 5 deletions
diff --git a/examples/executors/processpool.py b/examples/executors/processpool.py
index 37f58bb..c2b19d5 100644
--- a/examples/executors/processpool.py
+++ b/examples/executors/processpool.py
@@ -2,8 +2,10 @@
Demonstrates how to schedule a job to be run in a process pool on 3 second intervals.
"""
-from datetime import datetime
+from __future__ import annotations
+
import os
+from datetime import datetime
from apscheduler.schedulers.blocking import BlockingScheduler
@@ -16,7 +18,7 @@ if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_executor('processpool')
scheduler.add_job(tick, 'interval', seconds=3)
- print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
+ print('Press Ctrl+{} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
scheduler.initialize()
diff --git a/examples/misc/reference.py b/examples/misc/reference.py
index 1479d2f..0005e1a 100644
--- a/examples/misc/reference.py
+++ b/examples/misc/reference.py
@@ -2,15 +2,16 @@
Basic example showing how to schedule a callable using a textual reference.
"""
+from __future__ import annotations
+
import os
from apscheduler.schedulers.blocking import BlockingScheduler
-
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job('sys:stdout.write', 'interval', seconds=3, args=['tick\n'])
- print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
+ print('Press Ctrl+{} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
scheduler.initialize()
diff --git a/examples/rpc/client.py b/examples/rpc/client.py
index 9393654..234446b 100644
--- a/examples/rpc/client.py
+++ b/examples/rpc/client.py
@@ -6,11 +6,12 @@ Then it schedules a job to run on 2 second intervals and sleeps for 10 seconds.
After that, it unschedules the job and exits.
"""
+from __future__ import annotations
+
from time import sleep
import rpyc
-
conn = rpyc.connect('localhost', 12345)
job = conn.root.add_job('server:print_text', 'interval', args=['Hello, World'], seconds=2)
sleep(10)
diff --git a/examples/rpc/server.py b/examples/rpc/server.py
index 4c7c705..f3a195c 100644
--- a/examples/rpc/server.py
+++ b/examples/rpc/server.py
@@ -7,6 +7,8 @@ To run, first install RPyC using pip. Then change the working directory to the `
and run it with ``python -m server``.
"""
+from __future__ import annotations
+
import rpyc
from rpyc.utils.server import ThreadedServer
diff --git a/examples/schedulers/async_.py b/examples/schedulers/async_.py
index ab1784f..5ea9dca 100644
--- a/examples/schedulers/async_.py
+++ b/examples/schedulers/async_.py
@@ -1,6 +1,9 @@
+from __future__ import annotations
+
import logging
import anyio
+
from apscheduler.schedulers.async_ import AsyncScheduler
from apscheduler.triggers.interval import IntervalTrigger
from apscheduler.workers.async_ import AsyncWorker
diff --git a/examples/schedulers/sync.py b/examples/schedulers/sync.py
index 7c7546b..369c535 100644
--- a/examples/schedulers/sync.py
+++ b/examples/schedulers/sync.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import logging
from apscheduler.schedulers.sync import Scheduler