fix(lint): resolve all ruff E402/F401/F841/I001 errors
- Move logger= after imports in planner/routes.py and setup_paddle.py - Add # noqa: E402 to intentional post-setup imports (app.py, core.py, migrate.py, test_supervisor.py) - Fix unused cursor variables (test_noindex.py) → _ - Move stray csv import to top of test_outreach.py - Auto-sort import blocks (test_email_templates, test_noindex, test_outreach) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ from .core import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
setup_logging()
|
setup_logging()
|
||||||
from .i18n import LANG_BLUEPRINTS, SUPPORTED_LANGS, get_country_name, get_translations
|
from .i18n import LANG_BLUEPRINTS, SUPPORTED_LANGS, get_country_name, get_translations # noqa: E402
|
||||||
|
|
||||||
_ASSET_VERSION = str(int(time.time()))
|
_ASSET_VERSION = str(int(time.time()))
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from dotenv import load_dotenv
|
|||||||
# These calls run synchronously on the event loop thread; a shorter cap limits stalls.
|
# These calls run synchronously on the event loop thread; a shorter cap limits stalls.
|
||||||
_RESEND_TIMEOUT_SECONDS = 10
|
_RESEND_TIMEOUT_SECONDS = 10
|
||||||
resend.default_http_client = resend.RequestsClient(timeout=_RESEND_TIMEOUT_SECONDS)
|
resend.default_http_client = resend.RequestsClient(timeout=_RESEND_TIMEOUT_SECONDS)
|
||||||
from quart import g, make_response, render_template, request, session
|
from quart import g, make_response, render_template, request, session # noqa: E402
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv # noqa: E402
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import logging
|
|||||||
import math
|
import math
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
from quart import Blueprint, Response, g, jsonify, render_template, request
|
from quart import Blueprint, Response, g, jsonify, render_template, request
|
||||||
|
|
||||||
from ..auth.routes import login_required
|
from ..auth.routes import login_required
|
||||||
@@ -25,6 +23,8 @@ from ..core import (
|
|||||||
from ..i18n import get_translations
|
from ..i18n import get_translations
|
||||||
from .calculator import COUNTRY_CURRENCY, CURRENCY_DEFAULT, calc, validate_state
|
from .calculator import COUNTRY_CURRENCY, CURRENCY_DEFAULT, calc, validate_state
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
"planner",
|
"planner",
|
||||||
__name__,
|
__name__,
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
from paddle_billing import Client as PaddleClient
|
from paddle_billing import Client as PaddleClient
|
||||||
from paddle_billing import Environment, Options
|
from paddle_billing import Environment, Options
|
||||||
from paddle_billing.Entities.Events.EventTypeName import EventTypeName
|
from paddle_billing.Entities.Events.EventTypeName import EventTypeName
|
||||||
@@ -28,6 +26,8 @@ from paddle_billing.Resources.Prices.Operations import CreatePrice
|
|||||||
from paddle_billing.Resources.Products.Operations import CreateProduct, ListProducts
|
from paddle_billing.Resources.Products.Operations import CreateProduct, ListProducts
|
||||||
from paddle_billing.Resources.Products.Operations.List.Includes import Includes
|
from paddle_billing.Resources.Products.Operations.List.Includes import Includes
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
PADDLE_API_KEY = os.getenv("PADDLE_API_KEY", "")
|
PADDLE_API_KEY = os.getenv("PADDLE_API_KEY", "")
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import pytest
|
|||||||
from padelnomics.core import utcnow_iso
|
from padelnomics.core import utcnow_iso
|
||||||
from padelnomics.email_templates import EMAIL_TEMPLATE_REGISTRY, render_email_template
|
from padelnomics.email_templates import EMAIL_TEMPLATE_REGISTRY, render_email_template
|
||||||
|
|
||||||
|
|
||||||
# ── render_email_template() ──────────────────────────────────────────────────
|
# ── render_email_template() ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,9 @@ Covers:
|
|||||||
- Article detail page has no robots meta tag for indexable articles
|
- Article detail page has no robots meta tag for indexable articles
|
||||||
"""
|
"""
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from unittest.mock import AsyncMock, patch
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from padelnomics import core
|
|
||||||
from padelnomics.content import NOINDEX_THRESHOLDS
|
from padelnomics.content import NOINDEX_THRESHOLDS
|
||||||
|
|
||||||
|
|
||||||
# ── Threshold unit tests ─────────────────────────────────────────────────────
|
# ── Threshold unit tests ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +151,7 @@ class TestArticleDetailRobotsTag:
|
|||||||
VALUES (?, ?, 'Noindex Test', '', 'published', '2020-01-01 08:00:00',
|
VALUES (?, ?, 'Noindex Test', '', 'published', '2020-01-01 08:00:00',
|
||||||
'city-pricing', 'en', 1, datetime('now'))""",
|
'city-pricing', 'en', 1, datetime('now'))""",
|
||||||
(url_path, slug),
|
(url_path, slug),
|
||||||
) as cursor:
|
) as _:
|
||||||
pass
|
pass
|
||||||
await db.commit()
|
await db.commit()
|
||||||
|
|
||||||
@@ -186,7 +181,7 @@ class TestArticleDetailRobotsTag:
|
|||||||
VALUES (?, ?, 'Indexable Test', '', 'published', '2020-01-01 08:00:00',
|
VALUES (?, ?, 'Indexable Test', '', 'published', '2020-01-01 08:00:00',
|
||||||
'city-pricing', 'en', 0, datetime('now'))""",
|
'city-pricing', 'en', 0, datetime('now'))""",
|
||||||
(url_path, slug),
|
(url_path, slug),
|
||||||
) as cursor:
|
) as _:
|
||||||
pass
|
pass
|
||||||
await db.commit()
|
await db.commit()
|
||||||
|
|
||||||
|
|||||||
@@ -12,21 +12,21 @@ Covers:
|
|||||||
- Compose pre-fill (GET /admin/emails/compose with outreach params)
|
- Compose pre-fill (GET /admin/emails/compose with outreach params)
|
||||||
- Compose send pipeline update (POST /admin/emails/compose with outreach type)
|
- Compose send pipeline update (POST /admin/emails/compose with outreach type)
|
||||||
"""
|
"""
|
||||||
|
import csv as _csv_module
|
||||||
import io
|
import io
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from quart.datastructures import FileStorage
|
|
||||||
|
|
||||||
from padelnomics import core
|
|
||||||
from padelnomics.admin.routes import (
|
from padelnomics.admin.routes import (
|
||||||
OUTREACH_STATUSES,
|
OUTREACH_STATUSES,
|
||||||
get_follow_up_due_count,
|
get_follow_up_due_count,
|
||||||
get_outreach_pipeline,
|
get_outreach_pipeline,
|
||||||
get_outreach_suppliers,
|
get_outreach_suppliers,
|
||||||
)
|
)
|
||||||
|
from quart.datastructures import FileStorage
|
||||||
|
|
||||||
|
from padelnomics import core
|
||||||
|
|
||||||
# ── Fixtures ──────────────────────────────────────────────────────────────────
|
# ── Fixtures ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -832,9 +832,6 @@ class TestActivityTimeline:
|
|||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# ── CSV writer helper (avoids importing DictWriter at module level) ────────────
|
|
||||||
|
|
||||||
import csv as _csv_module
|
|
||||||
|
|
||||||
|
|
||||||
def _csv_writer(buf, fieldnames):
|
def _csv_writer(buf, fieldnames):
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ _spec = _ilu.spec_from_file_location("padelnomics_supervisor", _SUP_PATH)
|
|||||||
sup = _ilu.module_from_spec(_spec)
|
sup = _ilu.module_from_spec(_spec)
|
||||||
_spec.loader.exec_module(sup)
|
_spec.loader.exec_module(sup)
|
||||||
|
|
||||||
from padelnomics_extract.proxy import (
|
from padelnomics_extract.proxy import ( # noqa: E402
|
||||||
load_proxy_urls,
|
load_proxy_urls,
|
||||||
make_round_robin_cycler,
|
make_round_robin_cycler,
|
||||||
make_sticky_selector,
|
make_sticky_selector,
|
||||||
|
|||||||
Reference in New Issue
Block a user