From 813fc2d809a3d7f80f8dda52cb59d2149e4943f1 Mon Sep 17 00:00:00 2001 From: Baymax Date: Tue, 5 May 2026 02:55:56 +0000 Subject: [PATCH 1/2] Apply code formatting fixes for pre-commit compatibility (SD-694) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- minject/inject.py | 4 ++-- minject/registry.py | 16 ++++++++++++++-- pyproject.toml | 2 +- tests/test_start_close.py | 8 ++------ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/minject/inject.py b/minject/inject.py index 873c45a..4b61adb 100644 --- a/minject/inject.py +++ b/minject/inject.py @@ -530,7 +530,7 @@ async def aresolve(self, registry_impl: Resolver) -> Resolver: "function", "reference", "self_tag", - "start_method", # deprecated - "close_method", # deprecated + "start_method", # deprecated + "close_method", # deprecated "async_context", ] diff --git a/minject/registry.py b/minject/registry.py index 39d896a..b4e2423 100644 --- a/minject/registry.py +++ b/minject/registry.py @@ -7,7 +7,19 @@ from contextlib import AsyncExitStack from textwrap import dedent from threading import RLock -from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, TypeVar, Union, cast +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterable, + List, + Mapping, + Optional, + TypeVar, + Union, + cast, +) from typing_extensions import Concatenate, ParamSpec @@ -328,7 +340,7 @@ async def _aget_by_metadata(self, meta: RegistryMetadata[T]) -> Optional[_Regist def __len__(self) -> int: return len(self._objects) - def __contains__(self, key : object) -> bool: + def __contains__(self, key: object) -> bool: """Check if an object is contained in the registry. Note that this method returns True if the object has already been registered. It is possible that the key provides enough information diff --git a/pyproject.toml b/pyproject.toml index 443271b..1efec27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,8 +14,8 @@ requires-python = ">=3.9" dependencies = ["attrs>=17.4", "packaging", "typing_extensions>=4.1"] [build-system] -requires = ["hatchling>=1.26.1"] build-backend = "hatchling.build" +requires = ["hatchling>=1.26.1"] [tool.hatch.version] path = "minject/__init__.py" diff --git a/tests/test_start_close.py b/tests/test_start_close.py index e7b3e0e..706b104 100644 --- a/tests/test_start_close.py +++ b/tests/test_start_close.py @@ -104,11 +104,9 @@ def close_func(obj: TestClass) -> None: def test_start_method_decorator_duplicate(self) -> None: """Test that start_method decorator correctly sets up a start function.""" - def start_func(obj : "TestClass") -> None: - ... + def start_func(obj: "TestClass") -> None: ... - def close_func(obj : "TestClass") -> None: - ... + def close_func(obj: "TestClass") -> None: ... @inject.bind(_start=start_func, _close=close_func) class TestClass: @@ -127,5 +125,3 @@ def noop(self) -> None: with self.assertRaises(ValueError): close_method(TestClass, lambda x: x.noop()) - - From 8a9c82f1f7a3c45c3fcfea5a06be2a62e7ba28f8 Mon Sep 17 00:00:00 2001 From: Baymax Date: Tue, 9 Jun 2026 21:01:19 +0000 Subject: [PATCH 2/2] test pre-commit check (no-op)