mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 23:44:57 -04:00
Update black, and run auto formatting over the codebase (#9381)
- Update black version to the latest
- Run black auto formatting over the codebase
- Run autoformatting according to [`docs/code_style.md
`](80d6dc9783/docs/code_style.md
)
- Update `code_style.md` docs around installing black to use the correct version
This commit is contained in:
parent
5636e597c3
commit
0a00b7ff14
271 changed files with 2802 additions and 1713 deletions
|
@ -252,8 +252,7 @@ class Linearizer:
|
|||
self.key_to_defer = {} # type: Dict[Hashable, _LinearizerEntry]
|
||||
|
||||
def is_queued(self, key: Hashable) -> bool:
|
||||
"""Checks whether there is a process queued up waiting
|
||||
"""
|
||||
"""Checks whether there is a process queued up waiting"""
|
||||
entry = self.key_to_defer.get(key)
|
||||
if not entry:
|
||||
# No entry so nothing is waiting.
|
||||
|
@ -452,7 +451,9 @@ R = TypeVar("R")
|
|||
|
||||
|
||||
def timeout_deferred(
|
||||
deferred: defer.Deferred, timeout: float, reactor: IReactorTime,
|
||||
deferred: defer.Deferred,
|
||||
timeout: float,
|
||||
reactor: IReactorTime,
|
||||
) -> defer.Deferred:
|
||||
"""The in built twisted `Deferred.addTimeout` fails to time out deferreds
|
||||
that have a canceller that throws exceptions. This method creates a new
|
||||
|
@ -529,8 +530,7 @@ def timeout_deferred(
|
|||
|
||||
@attr.s(slots=True, frozen=True)
|
||||
class DoneAwaitable:
|
||||
"""Simple awaitable that returns the provided value.
|
||||
"""
|
||||
"""Simple awaitable that returns the provided value."""
|
||||
|
||||
value = attr.ib()
|
||||
|
||||
|
@ -545,8 +545,7 @@ class DoneAwaitable:
|
|||
|
||||
|
||||
def maybe_awaitable(value: Union[Awaitable[R], R]) -> Awaitable[R]:
|
||||
"""Convert a value to an awaitable if not already an awaitable.
|
||||
"""
|
||||
"""Convert a value to an awaitable if not already an awaitable."""
|
||||
if inspect.isawaitable(value):
|
||||
assert isinstance(value, Awaitable)
|
||||
return value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue