diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2021-02-16 16:32:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 22:32:34 +0000 |
commit | 0a00b7ff14890987f09112a2ae696c61001e6cf1 (patch) | |
tree | e662b6da7679b47276d8a865e3dc9b531d1cd9bd /synapse/logging | |
parent | Fix OIDC gitiea redirect URL. (#9404) (diff) | |
download | synapse-0a00b7ff14890987f09112a2ae696c61001e6cf1.tar.xz |
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 `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
Diffstat (limited to 'synapse/logging')
-rw-r--r-- | synapse/logging/_remote.py | 4 | ||||
-rw-r--r-- | synapse/logging/_structured.py | 9 | ||||
-rw-r--r-- | synapse/logging/context.py | 12 | ||||
-rw-r--r-- | synapse/logging/opentracing.py | 8 | ||||
-rw-r--r-- | synapse/logging/utils.py | 3 |
5 files changed, 23 insertions, 13 deletions
diff --git a/synapse/logging/_remote.py b/synapse/logging/_remote.py index fb937b3f28..f8e9112b56 100644 --- a/synapse/logging/_remote.py +++ b/synapse/logging/_remote.py @@ -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() diff --git a/synapse/logging/_structured.py b/synapse/logging/_structured.py index 14d9c104c2..3e054f615c 100644 --- a/synapse/logging/_structured.py +++ b/synapse/logging/_structured.py @@ -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. diff --git a/synapse/logging/context.py b/synapse/logging/context.py index c2db8b45f3..78e27bfb00 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -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, + ) ) diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py index 0538350f38..10bd4a1461 100644 --- a/synapse/logging/opentracing.py +++ b/synapse/logging/opentracing.py @@ -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) diff --git a/synapse/logging/utils.py b/synapse/logging/utils.py index becf66dd86..fd3543ab04 100644 --- a/synapse/logging/utils.py +++ b/synapse/logging/utils.py @@ -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) |