This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 0fd3468 Add some missing top level types
0fd3468 is described below
commit 0fd3468a07ff5e77cd77f45d4e0d716b5a6d3379
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Apr 23 18:51:06 2025 +0100
Add some missing top level types
---
atr/blueprints/admin/admin.py | 4 ++--
atr/mail.py | 2 +-
atr/manager.py | 2 +-
atr/revision.py | 3 ++-
atr/routes/__init__.py | 4 ++--
atr/tasks/bulk.py | 4 ++--
atr/tasks/checks/license.py | 2 +-
atr/tasks/checks/signature.py | 2 +-
atr/tasks/checks/zipformat.py | 4 ++--
atr/util.py | 4 ++--
10 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/atr/blueprints/admin/admin.py b/atr/blueprints/admin/admin.py
index 45da145..8773e2b 100644
--- a/atr/blueprints/admin/admin.py
+++ b/atr/blueprints/admin/admin.py
@@ -22,7 +22,7 @@ import pathlib
import statistics
import uuid
from collections.abc import Callable, Mapping
-from typing import Any
+from typing import Any, Final
import aiofiles.os
import aioshutil
@@ -40,7 +40,7 @@ import atr.db as db
import atr.db.models as models
import atr.util as util
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
class DeleteReleaseForm(util.QuartFormTyped):
diff --git a/atr/mail.py b/atr/mail.py
index 1de0378..c81a80c 100644
--- a/atr/mail.py
+++ b/atr/mail.py
@@ -29,7 +29,7 @@ import dkim
import atr.db as db
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
# TODO: We should choose a pattern for globals
# We could e.g. use uppercase instead of global_
diff --git a/atr/manager.py b/atr/manager.py
index 0c27f92..c8a81d0 100644
--- a/atr/manager.py
+++ b/atr/manager.py
@@ -36,7 +36,7 @@ import atr.db.models as models
_LOGGER: Final = logging.getLogger(__name__)
# Global debug flag to control worker process output capturing
-global_worker_debug = False
+global_worker_debug: bool = False
# Global worker manager instance
# Can't use "StringClass" | None, must use Optional["StringClass"] for forward
references
diff --git a/atr/revision.py b/atr/revision.py
index 3c83bde..259936d 100644
--- a/atr/revision.py
+++ b/atr/revision.py
@@ -20,6 +20,7 @@ import datetime
import logging
import pathlib
from collections.abc import AsyncGenerator
+from typing import Final
import aiofiles.os
@@ -28,7 +29,7 @@ import atr.db.models as models
import atr.tasks as tasks
import atr.util as util
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
@contextlib.asynccontextmanager
diff --git a/atr/routes/__init__.py b/atr/routes/__init__.py
index aa1ef33..b0f7d2d 100644
--- a/atr/routes/__init__.py
+++ b/atr/routes/__init__.py
@@ -272,10 +272,10 @@ class MicrosecondsFormatter(logging.Formatter):
# Setup a dedicated logger for route performance metrics
# NOTE: This code block must come after AsyncFileHandler and
MicrosecondsFormatter
-route_logger = logging.getLogger("route.performance")
+route_logger: Final = logging.getLogger("route.performance")
# Use custom formatter that properly includes microseconds
# TODO: Is this actually UTC?
-route_logger_handler = AsyncFileHandler("route-performance.log")
+route_logger_handler: Final[AsyncFileHandler] =
AsyncFileHandler("route-performance.log")
route_logger_handler.setFormatter(MicrosecondsFormatter("%(asctime)s -
%(message)s"))
route_logger.addHandler(route_logger_handler)
route_logger.setLevel(logging.INFO)
diff --git a/atr/tasks/bulk.py b/atr/tasks/bulk.py
index 76e221f..2903a5f 100644
--- a/atr/tasks/bulk.py
+++ b/atr/tasks/bulk.py
@@ -37,11 +37,11 @@ _LOGGER: Final = logging.getLogger(__name__)
_LOGGER.setLevel(logging.DEBUG)
# Create file handler for test.log
-file_handler = logging.FileHandler("tasks-bulk.log")
+file_handler: Final[logging.FileHandler] =
logging.FileHandler("tasks-bulk.log")
file_handler.setLevel(logging.DEBUG)
# Create formatter with detailed information
-formatter = logging.Formatter(
+formatter: Final[logging.Formatter] = logging.Formatter(
"[%(asctime)s.%(msecs)03d] [%(process)d] [%(levelname)s]
[%(name)s:%(funcName)s:%(lineno)d] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
diff --git a/atr/tasks/checks/license.py b/atr/tasks/checks/license.py
index cacee1e..9d1c226 100644
--- a/atr/tasks/checks/license.py
+++ b/atr/tasks/checks/license.py
@@ -26,7 +26,7 @@ from typing import Any, Final
import atr.tasks.checks as checks
import atr.tasks.checks.targz as targz
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
# Constant that must be present in the Apache License header
diff --git a/atr/tasks/checks/signature.py b/atr/tasks/checks/signature.py
index 3811e8c..e9a52fd 100644
--- a/atr/tasks/checks/signature.py
+++ b/atr/tasks/checks/signature.py
@@ -27,7 +27,7 @@ import atr.db as db
import atr.db.models as models
import atr.tasks.checks as checks
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
async def check(args: checks.FunctionArguments) -> str | None:
diff --git a/atr/tasks/checks/zipformat.py b/atr/tasks/checks/zipformat.py
index d95fee1..39a626e 100644
--- a/atr/tasks/checks/zipformat.py
+++ b/atr/tasks/checks/zipformat.py
@@ -19,12 +19,12 @@ import asyncio
import logging
import os
import zipfile
-from typing import Any
+from typing import Any, Final
import atr.tasks.checks as checks
import atr.tasks.checks.license as license
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
async def integrity(args: checks.FunctionArguments) -> str | None:
diff --git a/atr/util.py b/atr/util.py
index 0ee6bb2..7c3f276 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -29,7 +29,7 @@ import tempfile
import uuid
import zipfile
from collections.abc import AsyncGenerator, Callable, Generator, ItemsView,
Mapping, Sequence
-from typing import Annotated, Any, TypeVar
+from typing import Annotated, Any, Final, TypeVar
import aiofiles.os
import asfquart
@@ -53,7 +53,7 @@ F = TypeVar("F", bound="QuartFormTyped")
T = TypeVar("T")
VT = TypeVar("VT")
-_LOGGER = logging.getLogger(__name__)
+_LOGGER: Final = logging.getLogger(__name__)
class DictRootModel(pydantic.RootModel[dict[str, VT]]):
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]