From 8a8efe18a20a722b42ab23f040c6cb1f1d12b6ba Mon Sep 17 00:00:00 2001 From: Mathijs de Bruin Date: Thu, 15 May 2025 13:27:55 +0100 Subject: [PATCH] Bump to current manage.py, solve linting issue. --- manage.py | 30 +++++++++++++++--------------- worker/tasks.py | 5 +++-- 2 files changed, 18 insertions(+), 17 deletions(-) mode change 100644 => 100755 manage.py diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 index 1fbf4d70..e8774b72 --- a/manage.py +++ b/manage.py @@ -1,22 +1,22 @@ #!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" import os import sys -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webodm.settings") + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webodm.settings') try: from django.core.management import execute_from_command_line - except ImportError: - # The above import may fail for some other reason. Ensure that the - # issue is really that Django is missing to avoid masking other - # exceptions on Python 2. - try: - import django - except ImportError: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) - raise + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/worker/tasks.py b/worker/tasks.py index 0b2fd353..4a312929 100644 --- a/worker/tasks.py +++ b/worker/tasks.py @@ -48,7 +48,7 @@ def update_nodes_info(): if processing_node.hostname == check_hostname and not processing_node.is_online(): try: socket.gethostbyname(processing_node.hostname) - except: + except: # noqa: E722 # Hostname was invalid, try renaming processing_node.hostname = 'webodm-node-odm-1' processing_node.update_node_info() @@ -158,7 +158,8 @@ def process_task(taskId): logger.error( "Uncaught error! This is potentially bad. Please report it to http://github.com/OpenDroneMap/WebODM/issues: {} {}".format( e, traceback.format_exc())) - if settings.TESTING: raise e + if settings.TESTING: + raise e finally: if cancel_monitor is not None: cancel_monitor()