From 829a09494a1675180999fea2f675508e832489c4 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 24 Feb 2024 16:40:53 +0300 Subject: [PATCH] Style: Fix `flake8` errors E302,E305 expected 2 blank lines, found 1 --- print-filename.py | 2 +- xsetbg-dbus-client.py | 2 ++ xsetbg-wsgi.py | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/print-filename.py b/print-filename.py index 676aed2..234d0a3 100755 --- a/print-filename.py +++ b/print-filename.py @@ -53,8 +53,8 @@ def get_args(): output_encoding = default_encoding return index, output_encoding -index, output_encoding = get_args() +index, output_encoding = get_args() filename = xsetbg_db.select('last_shown IS NOT NULL', orderBy='-last_shown')[index].full_name diff --git a/xsetbg-dbus-client.py b/xsetbg-dbus-client.py index e3a7825..b2aff34 100755 --- a/xsetbg-dbus-client.py +++ b/xsetbg-dbus-client.py @@ -6,6 +6,7 @@ import sys import dbus + def main(): try: command = sys.argv[1] @@ -18,5 +19,6 @@ def main(): getattr(iface, command)() + if __name__ == '__main__': main() diff --git a/xsetbg-wsgi.py b/xsetbg-wsgi.py index 92d1253..c4d5800 100755 --- a/xsetbg-wsgi.py +++ b/xsetbg-wsgi.py @@ -25,18 +25,22 @@ else: commands = {} + def published(func): commands[func.__name__] = func return func + @published def change(force=False): _change() + @published def force(): _change(force=True) + @published def stop(): QuitWSGIServer._quit_flag = True @@ -49,6 +53,7 @@ class QuitWSGIServer(WSGIServer): while not self._quit_flag: self.handle_request() + def app(env, start_response): command = env['PATH_INFO'][1:] # Remove the leading slash if command not in commands: @@ -70,6 +75,7 @@ def app(env, start_response): start_response(status, response_headers) return ['Ok\n'] + force() httpd = make_server(host, port, app, server_class=QuitWSGIServer) httpd.serve_forever() -- 2.39.2