Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/klein/_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
"""
Expand Down
6 changes: 2 additions & 4 deletions src/klein/_imessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand Down
30 changes: 10 additions & 20 deletions src/klein/_isession.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/klein/_paramspec_workaround.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/klein/_plating.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Templating wrapper support for Klein.
"""

from __future__ import annotations

from functools import partial
Expand Down
4 changes: 2 additions & 2 deletions src/klein/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/klein/test/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading