From b20f62d929eed84ad18020bb82dd43d8cb70da4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Wed, 20 Apr 2022 01:00:57 +0300 Subject: Switched to Black for code formatting --- examples/executors/processpool.py | 10 +++++----- examples/misc/reference.py | 6 +++--- examples/rpc/client.py | 6 ++++-- examples/rpc/server.py | 12 ++++++++---- examples/schedulers/async_.py | 3 ++- examples/schedulers/sync.py | 6 ++++-- 6 files changed, 26 insertions(+), 17 deletions(-) (limited to 'examples') diff --git a/examples/executors/processpool.py b/examples/executors/processpool.py index c2b19d5..f8538e1 100644 --- a/examples/executors/processpool.py +++ b/examples/executors/processpool.py @@ -11,14 +11,14 @@ from apscheduler.schedulers.blocking import BlockingScheduler def tick(): - print('Tick! The time is: %s' % datetime.now()) + print("Tick! The time is: %s" % datetime.now()) -if __name__ == '__main__': +if __name__ == "__main__": scheduler = BlockingScheduler() - scheduler.add_executor('processpool') - scheduler.add_job(tick, 'interval', seconds=3) - print('Press Ctrl+{} to exit'.format('Break' if os.name == 'nt' else 'C')) + scheduler.add_executor("processpool") + scheduler.add_job(tick, "interval", seconds=3) + 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 0005e1a..75bfb1c 100644 --- a/examples/misc/reference.py +++ b/examples/misc/reference.py @@ -8,10 +8,10 @@ import os from apscheduler.schedulers.blocking import BlockingScheduler -if __name__ == '__main__': +if __name__ == "__main__": scheduler = BlockingScheduler() - scheduler.add_job('sys:stdout.write', 'interval', seconds=3, args=['tick\n']) - print('Press Ctrl+{} to exit'.format('Break' if os.name == 'nt' else 'C')) + scheduler.add_job("sys:stdout.write", "interval", seconds=3, args=["tick\n"]) + 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 234446b..2a3a52a 100644 --- a/examples/rpc/client.py +++ b/examples/rpc/client.py @@ -12,7 +12,9 @@ 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) +conn = rpyc.connect("localhost", 12345) +job = conn.root.add_job( + "server:print_text", "interval", args=["Hello, World"], seconds=2 +) sleep(10) conn.root.remove_job(job.id) diff --git a/examples/rpc/server.py b/examples/rpc/server.py index f3a195c..fc40c04 100644 --- a/examples/rpc/server.py +++ b/examples/rpc/server.py @@ -26,7 +26,9 @@ class SchedulerService(rpyc.Service): def exposed_modify_job(self, job_id, jobstore=None, **changes): return scheduler.modify_job(job_id, jobstore, **changes) - def exposed_reschedule_job(self, job_id, jobstore=None, trigger=None, **trigger_args): + def exposed_reschedule_job( + self, job_id, jobstore=None, trigger=None, **trigger_args + ): return scheduler.reschedule_job(job_id, jobstore, trigger, **trigger_args) def exposed_pause_job(self, job_id, jobstore=None): @@ -45,11 +47,13 @@ class SchedulerService(rpyc.Service): return scheduler.get_jobs(jobstore) -if __name__ == '__main__': +if __name__ == "__main__": scheduler = BackgroundScheduler() scheduler.initialize() - protocol_config = {'allow_public_attrs': True} - server = ThreadedServer(SchedulerService, port=12345, protocol_config=protocol_config) + protocol_config = {"allow_public_attrs": True} + server = ThreadedServer( + SchedulerService, port=12345, protocol_config=protocol_config + ) try: server.initialize() except (KeyboardInterrupt, SystemExit): diff --git a/examples/schedulers/async_.py b/examples/schedulers/async_.py index 5ea9dca..e4eac0c 100644 --- a/examples/schedulers/async_.py +++ b/examples/schedulers/async_.py @@ -10,7 +10,7 @@ from apscheduler.workers.async_ import AsyncWorker def say_hello(): - print('Hello!') + print("Hello!") async def main(): @@ -18,6 +18,7 @@ async def main(): await scheduler.add_schedule(say_hello, IntervalTrigger(seconds=1)) await scheduler.wait_until_stopped() + logging.basicConfig(level=logging.DEBUG) try: anyio.run(main) diff --git a/examples/schedulers/sync.py b/examples/schedulers/sync.py index 369c535..12ae17f 100644 --- a/examples/schedulers/sync.py +++ b/examples/schedulers/sync.py @@ -8,12 +8,14 @@ from apscheduler.workers.sync import Worker def say_hello(): - print('Hello!') + print("Hello!") logging.basicConfig(level=logging.DEBUG) try: - with Scheduler() as scheduler, Worker(scheduler.data_store, portal=scheduler.portal): + with Scheduler() as scheduler, Worker( + scheduler.data_store, portal=scheduler.portal + ): scheduler.add_schedule(say_hello, IntervalTrigger(seconds=1)) scheduler.wait_until_stopped() except (KeyboardInterrupt, SystemExit): -- cgit v1.2.1