From b8e2f6db3d7d5fe7d757801897a623445733920d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Bartosi=C5=84ski?= Date: Thu, 12 Dec 2024 12:17:58 +0100 Subject: [PATCH 1/2] Make files with shebangs executable --- bin/get-accounts-for-host.py | 2 +- bin/restart-forgotten-accounts.py | 2 +- bin/set-desired-host.py | 2 +- bin/set-throttled.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 bin/get-accounts-for-host.py mode change 100644 => 100755 bin/restart-forgotten-accounts.py mode change 100644 => 100755 bin/set-desired-host.py mode change 100644 => 100755 bin/set-throttled.py diff --git a/bin/get-accounts-for-host.py b/bin/get-accounts-for-host.py old mode 100644 new mode 100755 index 12bfe57db..77ec6d885 --- a/bin/get-accounts-for-host.py +++ b/bin/get-accounts-for-host.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: EXE001, N999 +#!/usr/bin/env python # noqa: N999 import click diff --git a/bin/restart-forgotten-accounts.py b/bin/restart-forgotten-accounts.py old mode 100644 new mode 100755 index 3a4754e01..7326b3ff5 --- a/bin/restart-forgotten-accounts.py +++ b/bin/restart-forgotten-accounts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: EXE001, N999 +#!/usr/bin/env python # noqa: N999 import time diff --git a/bin/set-desired-host.py b/bin/set-desired-host.py old mode 100644 new mode 100755 index 98a8c11ca..3a5010ce7 --- a/bin/set-desired-host.py +++ b/bin/set-desired-host.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: EXE001, N999 +#!/usr/bin/env python # noqa: N999 import click diff --git a/bin/set-throttled.py b/bin/set-throttled.py old mode 100644 new mode 100755 index 5b4862099..f134e4ea1 --- a/bin/set-throttled.py +++ b/bin/set-throttled.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: EXE001, N999 +#!/usr/bin/env python # noqa: N999 # throttle or unthrottle an account From 4f4ea8a7a86544c28605a432dae6e1bdff727e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Bartosi=C5=84ski?= Date: Thu, 12 Dec 2024 12:25:04 +0100 Subject: [PATCH 2/2] Remove `# noqa: N999` from shebangs --- bin/backfix-duplicate-categories.py | 2 +- bin/backfix-generic-imap-separators.py | 2 +- bin/check-attachments.py | 2 +- bin/clear-all-heartbeats.py | 2 +- bin/clear-db.py | 2 +- bin/clear-heartbeat-status.py | 2 +- bin/clear-kv.py | 2 +- bin/correct-autoincrements.py | 2 +- bin/create-db.py | 2 +- bin/create-encryption-keys.py | 2 +- bin/create-event-contact-associations.py | 2 +- bin/delete-account-data.py | 2 +- bin/delete-marked-accounts.py | 2 +- bin/detect-missing-sync-host.py | 2 +- bin/get-accounts-for-host.py | 2 +- bin/get-id.py | 2 +- bin/get-object.py | 2 +- bin/inbox-api.py | 2 +- bin/inbox-auth.py | 2 +- bin/inbox-console.py | 2 +- bin/inbox-start.py | 2 +- bin/migrate-db.py | 2 +- bin/mysql-prompt.py | 2 +- bin/purge-transaction-log.py | 2 +- bin/remove-message-attachments.py | 2 +- bin/restart-forgotten-accounts.py | 2 +- bin/set-desired-host.py | 2 +- bin/set-throttled.py | 2 +- bin/stamp-db.py | 2 +- bin/sync-single-account.py | 2 +- bin/syncback-service.py | 2 +- bin/syncback-stats.py | 2 +- bin/unschedule-account-syncs.py | 2 +- bin/update-categories.py | 2 +- bin/verify-db.py | 2 +- pyproject.toml | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bin/backfix-duplicate-categories.py b/bin/backfix-duplicate-categories.py index 3a85ff73e..5057b4ed8 100755 --- a/bin/backfix-duplicate-categories.py +++ b/bin/backfix-duplicate-categories.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # Duplicate categories were created because of an inadequate unique constraint # in MySQL. This script deletes duplicate categories with no messages # associated. If two or more duplicate categories exist with associated diff --git a/bin/backfix-generic-imap-separators.py b/bin/backfix-generic-imap-separators.py index 104225334..fa92c8e9f 100755 --- a/bin/backfix-generic-imap-separators.py +++ b/bin/backfix-generic-imap-separators.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # We previously didn't store IMAP path separators for generic imap accounts. # This script backfixes the accounts. diff --git a/bin/check-attachments.py b/bin/check-attachments.py index 414b3ba13..534d0eba2 100755 --- a/bin/check-attachments.py +++ b/bin/check-attachments.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # Check that we can fetch attachments for 99.9% of our syncing accounts. import concurrent.futures import datetime diff --git a/bin/clear-all-heartbeats.py b/bin/clear-all-heartbeats.py index 724a98449..56aea03df 100755 --- a/bin/clear-all-heartbeats.py +++ b/bin/clear-all-heartbeats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python from sys import exit diff --git a/bin/clear-db.py b/bin/clear-db.py index 77f123f27..8c2c69e77 100755 --- a/bin/clear-db.py +++ b/bin/clear-db.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import argparse import sys diff --git a/bin/clear-heartbeat-status.py b/bin/clear-heartbeat-status.py index 4070d7525..516a62f29 100755 --- a/bin/clear-heartbeat-status.py +++ b/bin/clear-heartbeat-status.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python from sys import exit diff --git a/bin/clear-kv.py b/bin/clear-kv.py index bfa9e8335..c0fa49362 100755 --- a/bin/clear-kv.py +++ b/bin/clear-kv.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python from sys import exit diff --git a/bin/correct-autoincrements.py b/bin/correct-autoincrements.py index f41f0e80a..4d4258ddd 100755 --- a/bin/correct-autoincrements.py +++ b/bin/correct-autoincrements.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/create-db.py b/bin/create-db.py index 536f1f449..d633650db 100755 --- a/bin/create-db.py +++ b/bin/create-db.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import os diff --git a/bin/create-encryption-keys.py b/bin/create-encryption-keys.py index 7dc1a1340..e18a6f0b7 100755 --- a/bin/create-encryption-keys.py +++ b/bin/create-encryption-keys.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import binascii diff --git a/bin/create-event-contact-associations.py b/bin/create-event-contact-associations.py index eddc45dc2..0b32b5681 100755 --- a/bin/create-event-contact-associations.py +++ b/bin/create-event-contact-associations.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python """ Create event contact associations for events that don't have any. """ diff --git a/bin/delete-account-data.py b/bin/delete-account-data.py index ea4086e90..00d882c21 100755 --- a/bin/delete-account-data.py +++ b/bin/delete-account-data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python """ Deletes an account's data permanently. diff --git a/bin/delete-marked-accounts.py b/bin/delete-marked-accounts.py index cb7530b7b..85a7f0417 100755 --- a/bin/delete-marked-accounts.py +++ b/bin/delete-marked-accounts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python """ Searches for accounts that are marked for deletion and deletes all of their data diff --git a/bin/detect-missing-sync-host.py b/bin/detect-missing-sync-host.py index 1ddd71b9c..5224888ee 100755 --- a/bin/detect-missing-sync-host.py +++ b/bin/detect-missing-sync-host.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/get-accounts-for-host.py b/bin/get-accounts-for-host.py index 77ec6d885..8ee51c887 100755 --- a/bin/get-accounts-for-host.py +++ b/bin/get-accounts-for-host.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/get-id.py b/bin/get-id.py index 8396a3e8d..20860aa3b 100755 --- a/bin/get-id.py +++ b/bin/get-id.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # Query the id corresponding to a public id and vice-versa. diff --git a/bin/get-object.py b/bin/get-object.py index 2cd22c5f6..9c1bdde37 100755 --- a/bin/get-object.py +++ b/bin/get-object.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # Query the id corresponding to a public id and vice-versa. diff --git a/bin/inbox-api.py b/bin/inbox-api.py index 5af5277be..643f1de2e 100755 --- a/bin/inbox-api.py +++ b/bin/inbox-api.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import os import sys diff --git a/bin/inbox-auth.py b/bin/inbox-auth.py index 5bcc8956a..e5301d8b8 100755 --- a/bin/inbox-auth.py +++ b/bin/inbox-auth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import sys diff --git a/bin/inbox-console.py b/bin/inbox-console.py index 093055450..77d0577ee 100755 --- a/bin/inbox-console.py +++ b/bin/inbox-console.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python from setproctitle import setproctitle diff --git a/bin/inbox-start.py b/bin/inbox-start.py index 060201961..f043a3bb2 100755 --- a/bin/inbox-start.py +++ b/bin/inbox-start.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import os diff --git a/bin/migrate-db.py b/bin/migrate-db.py index a8d2ad0d3..57ae7f6d1 100755 --- a/bin/migrate-db.py +++ b/bin/migrate-db.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import os diff --git a/bin/mysql-prompt.py b/bin/mysql-prompt.py index 9bf74e950..7093f0062 100755 --- a/bin/mysql-prompt.py +++ b/bin/mysql-prompt.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import subprocess diff --git a/bin/purge-transaction-log.py b/bin/purge-transaction-log.py index 55ed23f77..da9af4aaf 100755 --- a/bin/purge-transaction-log.py +++ b/bin/purge-transaction-log.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python """ Deletes entries in the transaction older than `days_ago` days( as measured by the created_at column) diff --git a/bin/remove-message-attachments.py b/bin/remove-message-attachments.py index 286d4f6f2..7e7453067 100755 --- a/bin/remove-message-attachments.py +++ b/bin/remove-message-attachments.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import datetime import enum import logging diff --git a/bin/restart-forgotten-accounts.py b/bin/restart-forgotten-accounts.py index 7326b3ff5..7a4a41210 100755 --- a/bin/restart-forgotten-accounts.py +++ b/bin/restart-forgotten-accounts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import time diff --git a/bin/set-desired-host.py b/bin/set-desired-host.py index 3a5010ce7..bdac3770f 100755 --- a/bin/set-desired-host.py +++ b/bin/set-desired-host.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/set-throttled.py b/bin/set-throttled.py index f134e4ea1..b16096512 100755 --- a/bin/set-throttled.py +++ b/bin/set-throttled.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python # throttle or unthrottle an account diff --git a/bin/stamp-db.py b/bin/stamp-db.py index e9bed0ec7..83a9be98d 100755 --- a/bin/stamp-db.py +++ b/bin/stamp-db.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import os diff --git a/bin/sync-single-account.py b/bin/sync-single-account.py index a1b3828d5..4423e8a7a 100755 --- a/bin/sync-single-account.py +++ b/bin/sync-single-account.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import logging from threading import BoundedSemaphore diff --git a/bin/syncback-service.py b/bin/syncback-service.py index 7382138d6..bec289672 100755 --- a/bin/syncback-service.py +++ b/bin/syncback-service.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python """ Run the syncback service separately. You should run this if you run the API under something like gunicorn. (For convenience, the bin/inbox-api script diff --git a/bin/syncback-stats.py b/bin/syncback-stats.py index 05bf06afd..403274099 100755 --- a/bin/syncback-stats.py +++ b/bin/syncback-stats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click from sqlalchemy import func diff --git a/bin/unschedule-account-syncs.py b/bin/unschedule-account-syncs.py index 14fea671c..9a547be09 100755 --- a/bin/unschedule-account-syncs.py +++ b/bin/unschedule-account-syncs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/update-categories.py b/bin/update-categories.py index b4287437b..7349edcca 100755 --- a/bin/update-categories.py +++ b/bin/update-categories.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python import click diff --git a/bin/verify-db.py b/bin/verify-db.py index 195550663..01448eb3d 100755 --- a/bin/verify-db.py +++ b/bin/verify-db.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python # noqa: N999 +#!/usr/bin/env python from inbox.config import config diff --git a/pyproject.toml b/pyproject.toml index 668ac7fa9..c9bc46484 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -150,6 +150,6 @@ unfixable = [ ] [tool.ruff.lint.per-file-ignores] -"bin/**.py" = ["T201", "E402"] +"bin/**.py" = ["T201", "E402", "N999"] "migrations/**.py" = ["T201", "E402"] "tests/**.py" = ["ANN"]