diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 906d339e..fc292f27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,13 +10,13 @@ repos: - id: pyupgrade args: ["--py37-plus", "--keep-runtime-typing"] - - repo: https://github.com/psf/black - rev: "25.1.0" + - repo: https://github.com/psf/black-pre-commit-mirror + rev: "26.5.1" hooks: - id: black - repo: https://github.com/PyCQA/autoflake - rev: "v2.3.1" + rev: "v2.3.3" hooks: - id: autoflake args: @@ -113,13 +113,13 @@ repos: pass_filenames: false - repo: https://github.com/PyCQA/isort - rev: "6.0.1" + rev: "9.0.0b1" hooks: - id: isort args: ["--filter-files"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v5.0.0" + rev: "v6.0.0" hooks: - id: check-ast - id: check-builtin-literals @@ -161,6 +161,6 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/mgedmin/check-manifest - rev: "0.50" + rev: "0.51" hooks: - id: check-manifest diff --git a/src/klein/_form.py b/src/klein/_form.py index 42e43dd4..4a2b1dcd 100644 --- a/src/klein/_form.py +++ b/src/klein/_form.py @@ -307,7 +307,7 @@ def number( cls, minimum: Optional[_N] = None, maximum: Optional[_N] = None, - kind: Callable[[str], _N] = float, # type:ignore[assignment] + kind: Callable[[str], _N] = float, # type: ignore[assignment] **kw: Any, ) -> "Field": """ diff --git a/src/klein/_imessage.py b/src/klein/_imessage.py index c0d6154b..b9a622eb 100644 --- a/src/klein/_imessage.py +++ b/src/klein/_imessage.py @@ -62,15 +62,13 @@ class IHTTPHeaders(Interface): well-behaved implementations. """ - rawHeaders: RawHeaders = Attribute( - """ + rawHeaders: RawHeaders = Attribute(""" Raw header data as a tuple in the from: C{((name, value), ...)}. C{name} and C{value} are bytes. Headers are provided in the order that they were received. Headers with multiple values are provided as separate name and value pairs. - """ - ) + """) def getValues(name: AnyStr) -> Iterable[AnyStr]: """ diff --git a/src/klein/_isession.py b/src/klein/_isession.py index 34dfca34..866b382b 100644 --- a/src/klein/_isession.py +++ b/src/klein/_isession.py @@ -58,8 +58,7 @@ class ISession(Interface): about how the session was negotiated with the client software, and """ - identifier = Attribute( - """ + identifier = Attribute(""" L{str} identifying a session. This value should be: @@ -70,25 +69,20 @@ class ISession(Interface): should be able to guess what it is 3. I{opaque} - it should contain no interesting information - """ - ) + """) - isConfidential = Attribute( - """ + isConfidential = Attribute(""" A L{bool} indicating whether this session mechanism transmitted over an encrypted transport, i.e., HTTPS. If C{True}, this means that this session can be used for sensitive information; otherwise, the information contained in it should be considered to be available to attackers. - """ - ) + """) - authenticatedBy = Attribute( - """ + authenticatedBy = Attribute(""" A L{SessionMechanism} indicating what mechanism was used to authenticate this session. - """ - ) + """) def authorize(interfaces: Iterable[Type[Interface]]) -> Deferred: """ @@ -197,17 +191,13 @@ class ISimpleAccount(Interface): Data-store agnostic account interface. """ - username = Attribute( - """ + username = Attribute(""" Unicode username. - """ - ) + """) - accountID = Attribute( - """ + accountID = Attribute(""" Unicode account-ID. - """ - ) + """) def bindSession(session: ISession) -> None: """ diff --git a/src/klein/_paramspec_workaround.py b/src/klein/_paramspec_workaround.py index f4737d77..0f145703 100644 --- a/src/klein/_paramspec_workaround.py +++ b/src/klein/_paramspec_workaround.py @@ -120,7 +120,7 @@ def decorator( ) -> _RuleCopy[P, R]: # branch kw-only arg is encoded in `P` via kwOnlyBranchArg so we cannot # check it here. - return decoratee # type:ignore[return-value] + return decoratee # type: ignore[return-value] return decorator diff --git a/src/klein/_plating.py b/src/klein/_plating.py index e9133dd2..dbff27af 100644 --- a/src/klein/_plating.py +++ b/src/klein/_plating.py @@ -3,6 +3,7 @@ """ Templating wrapper support for Klein. """ + from __future__ import annotations from functools import partial diff --git a/src/klein/_resource.py b/src/klein/_resource.py index e0917788..55407025 100644 --- a/src/klein/_resource.py +++ b/src/klein/_resource.py @@ -30,7 +30,7 @@ def route_metadata(handler: KleinRouteHandler) -> RouteMetadata: - return handler # type:ignore[return-value] + return handler # type: ignore[return-value] def ensure_utf8_bytes(v: Union[str, bytes]) -> bytes: @@ -199,7 +199,7 @@ def _execute() -> Deferred: # to percolate up. If that happens it will be handled below in # processing_failed, either by a user-registered error handler or # one of our defaults. - (rule, kwargs) = mapper.match(return_rule=True) + rule, kwargs = mapper.match(return_rule=True) endpoint = rule.endpoint # Try pretty hard to fix up prepath and postpath. diff --git a/src/klein/test/test_resource.py b/src/klein/test/test_resource.py index 1070f545..07a9f477 100644 --- a/src/klein/test/test_resource.py +++ b/src/klein/test/test_resource.py @@ -1324,7 +1324,7 @@ def test_failServerName(self) -> None: Raises URLDecodeError if SERVER_NAME can't be decoded. """ request = MockRequest(b"/foo") - request.getRequestHostname = ( # type:ignore[method-assign] + request.getRequestHostname = ( # type: ignore[method-assign] lambda: b"f\xc3\xc3\xb6" ) e = self.assertRaises(URLDecodeError, extractURLparts, request) @@ -1354,7 +1354,7 @@ def test_failAll(self) -> None: """ request = MockRequest(b"/f\xc3\xc3\xb6") request.prepath = [b"f\xc3\xc3\xb6"] - request.getRequestHostname = ( # type:ignore[method-assign] + request.getRequestHostname = ( # type: ignore[method-assign] lambda: b"f\xc3\xc3\xb6" ) e = self.assertRaises(URLDecodeError, extractURLparts, request)