Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Another batch of type annotations #12726

Merged
merged 11 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ disallow_untyped_defs = True
[mypy-synapse.logging.context]
disallow_untyped_defs = True

[mypy-synapse.logging.formatter]
disallow_untyped_defs = True

[mypy-synapse.logging.handlers]
disallow_untyped_defs = True

Expand Down
14 changes: 10 additions & 4 deletions synapse/logging/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import logging
import traceback
from io import StringIO
from types import TracebackType
from typing import Tuple, Optional, Type


class LogFormatter(logging.Formatter):
Expand All @@ -28,10 +30,14 @@ class LogFormatter(logging.Formatter):
where it was caught are logged).
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved

def formatException(self, ei):
def formatException(
self,
ei: Tuple[
Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType],
],
) -> str:
sio = StringIO()
(typ, val, tb) = ei

Expand Down