mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-11 00:16:50 -05: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
|
|
@ -174,7 +174,9 @@ class RemoteHandler(logging.Handler):
|
|||
|
||||
# Make a new producer and start it.
|
||||
self._producer = LogProducer(
|
||||
buffer=self._buffer, transport=result.transport, format=self.format,
|
||||
buffer=self._buffer,
|
||||
transport=result.transport,
|
||||
format=self.format,
|
||||
)
|
||||
result.transport.registerProducer(self._producer, True)
|
||||
self._producer.resumeProducing()
|
||||
|
|
|
|||
|
|
@ -60,7 +60,10 @@ def parse_drain_configs(
|
|||
)
|
||||
|
||||
# Either use the default formatter or the tersejson one.
|
||||
if logging_type in (DrainType.CONSOLE_JSON, DrainType.FILE_JSON,):
|
||||
if logging_type in (
|
||||
DrainType.CONSOLE_JSON,
|
||||
DrainType.FILE_JSON,
|
||||
):
|
||||
formatter = "json" # type: Optional[str]
|
||||
elif logging_type in (
|
||||
DrainType.CONSOLE_JSON_TERSE,
|
||||
|
|
@ -131,7 +134,9 @@ def parse_drain_configs(
|
|||
)
|
||||
|
||||
|
||||
def setup_structured_logging(log_config: dict,) -> dict:
|
||||
def setup_structured_logging(
|
||||
log_config: dict,
|
||||
) -> dict:
|
||||
"""
|
||||
Convert a legacy structured logging configuration (from Synapse < v1.23.0)
|
||||
to one compatible with the new standard library handlers.
|
||||
|
|
|
|||
|
|
@ -338,7 +338,10 @@ class LoggingContext:
|
|||
if self.previous_context != old_context:
|
||||
logcontext_error(
|
||||
"Expected previous context %r, found %r"
|
||||
% (self.previous_context, old_context,)
|
||||
% (
|
||||
self.previous_context,
|
||||
old_context,
|
||||
)
|
||||
)
|
||||
return self
|
||||
|
||||
|
|
@ -562,7 +565,7 @@ class LoggingContextFilter(logging.Filter):
|
|||
class PreserveLoggingContext:
|
||||
"""Context manager which replaces the logging context
|
||||
|
||||
The previous logging context is restored on exit."""
|
||||
The previous logging context is restored on exit."""
|
||||
|
||||
__slots__ = ["_old_context", "_new_context"]
|
||||
|
||||
|
|
@ -585,7 +588,10 @@ class PreserveLoggingContext:
|
|||
else:
|
||||
logcontext_error(
|
||||
"Expected logging context %s but found %s"
|
||||
% (self._new_context, context,)
|
||||
% (
|
||||
self._new_context,
|
||||
context,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -238,8 +238,7 @@ try:
|
|||
|
||||
@attr.s(slots=True, frozen=True)
|
||||
class _WrappedRustReporter:
|
||||
"""Wrap the reporter to ensure `report_span` never throws.
|
||||
"""
|
||||
"""Wrap the reporter to ensure `report_span` never throws."""
|
||||
|
||||
_reporter = attr.ib(type=Reporter, default=attr.Factory(Reporter))
|
||||
|
||||
|
|
@ -326,8 +325,7 @@ def noop_context_manager(*args, **kwargs):
|
|||
|
||||
|
||||
def init_tracer(hs: "HomeServer"):
|
||||
"""Set the whitelists and initialise the JaegerClient tracer
|
||||
"""
|
||||
"""Set the whitelists and initialise the JaegerClient tracer"""
|
||||
global opentracing
|
||||
if not hs.config.opentracer_enabled:
|
||||
# We don't have a tracer
|
||||
|
|
@ -384,7 +382,7 @@ def whitelisted_homeserver(destination):
|
|||
|
||||
Args:
|
||||
destination (str)
|
||||
"""
|
||||
"""
|
||||
|
||||
if _homeserver_whitelist:
|
||||
return _homeserver_whitelist.match(destination)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ def _log_debug_as_f(f, msg, msg_args):
|
|||
|
||||
|
||||
def log_function(f):
|
||||
""" Function decorator that logs every call to that function.
|
||||
"""
|
||||
"""Function decorator that logs every call to that function."""
|
||||
func_name = f.__name__
|
||||
|
||||
@wraps(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue