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
2 changes: 2 additions & 0 deletions CHANGES/1325.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Enable automatic upgrades from ruff after each python version that is dropped
-- by :user:`Vizonex`.
5 changes: 1 addition & 4 deletions benchmarks/becnhmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@


def benchmark_name(name, ctx, prefix=None, use_prefix=False):
if use_prefix:
return "%s%s" % (prefix % ctx, name)

return name
return f"{prefix % ctx}{name}" if use_prefix else name


def add_impl_option(cmd, args):
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/istr.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@


def benchmark_name(name, ctx, prefix=None, use_prefix=False):
if use_prefix:
return "%s%s" % (prefix % ctx, name)

return name
return f"{prefix % ctx}{name}" if use_prefix else name


def add_impl_option(cmd, args):
Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# multidict documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 5 12:35:35 2014.
Expand Down Expand Up @@ -382,7 +381,7 @@ def _replace_missing_aiohttp_hdrs_reference(
env: BuildEnvironment,
node: pending_xref,
contnode: literal,
) -> "reference | None":
) -> reference | None:
if (node.get("refdomain"), node.get("reftype")) != ("py", "mod"):
return None

Expand Down
18 changes: 9 additions & 9 deletions multidict/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ def keys(self) -> Iterable[istr]: ...
def __getitem__(self, key: istr, /) -> _V_co: ...


MDArg = Union[SupportsKeys[_V], SupportsIKeys[_V], Iterable[tuple[str, _V]], None]
MDArg = SupportsKeys[_V] | SupportsIKeys[_V] | Iterable[tuple[str, _V]] | None


class MultiMapping(Mapping[str, _V_co]):
@overload
def getall(self, key: str) -> list[_V_co]: ...
@overload
def getall(self, key: str, default: _T) -> Union[list[_V_co], _T]: ...
def getall(self, key: str, default: _T) -> list[_V_co] | _T: ...
Comment thread
bdraco marked this conversation as resolved.
Dismissed
@abc.abstractmethod
def getall(self, key: str, default: _T = ...) -> Union[list[_V_co], _T]:
def getall(self, key: str, default: _T = ...) -> list[_V_co] | _T:
"""Return all values for key."""

@overload
def getone(self, key: str) -> _V_co: ...
@overload
def getone(self, key: str, default: _T) -> Union[_V_co, _T]: ...
def getone(self, key: str, default: _T) -> _V_co | _T: ...
Comment thread
bdraco marked this conversation as resolved.
Dismissed
@abc.abstractmethod
def getone(self, key: str, default: _T = ...) -> Union[_V_co, _T]:
def getone(self, key: str, default: _T = ...) -> _V_co | _T:
"""Return first value for key."""


Expand All @@ -59,15 +59,15 @@ def merge(self, arg: MDArg[_V] = None, /, **kwargs: _V) -> None:
@overload
def popone(self, key: str) -> _V: ...
@overload
def popone(self, key: str, default: _T) -> Union[_V, _T]: ...
def popone(self, key: str, default: _T) -> _V | _T: ...
Comment thread
bdraco marked this conversation as resolved.
Dismissed
@abc.abstractmethod
def popone(self, key: str, default: _T = ...) -> Union[_V, _T]:
def popone(self, key: str, default: _T = ...) -> _V | _T:
"""Remove specified key and return the corresponding value."""

@overload
def popall(self, key: str) -> list[_V]: ...
@overload
def popall(self, key: str, default: _T) -> Union[list[_V], _T]: ...
def popall(self, key: str, default: _T) -> list[_V] | _T: ...
Comment thread
bdraco marked this conversation as resolved.
Dismissed
@abc.abstractmethod
def popall(self, key: str, default: _T = ...) -> Union[list[_V], _T]:
def popall(self, key: str, default: _T = ...) -> list[_V] | _T:
"""Remove all occurrences of key and return the list of corresponding values."""
Loading
Loading