Skip to content

Commit

Permalink
Black 24
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jan 26, 2024
1 parent 8dfb2d7 commit 5c3bc79
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.1.14
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 3 additions & 3 deletions src/structlog/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class _Configuration:
default_processors: Iterable[Processor] = _BUILTIN_DEFAULT_PROCESSORS[:]
default_context_class: type[Context] = _BUILTIN_DEFAULT_CONTEXT_CLASS
default_wrapper_class: Any = _BUILTIN_DEFAULT_WRAPPER_CLASS
logger_factory: Callable[
..., WrappedLogger
] = _BUILTIN_DEFAULT_LOGGER_FACTORY
logger_factory: Callable[..., WrappedLogger] = (
_BUILTIN_DEFAULT_LOGGER_FACTORY
)
cache_logger_on_first_use: bool = _BUILTIN_CACHE_LOGGER_ON_FIRST_USE


Expand Down
2 changes: 2 additions & 0 deletions src/structlog/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class BytesLogger:
.. versionadded:: 20.2.0
"""

__slots__ = ("_file", "_write", "_flush", "_lock")

def __init__(self, file: BinaryIO | None = None):
Expand Down Expand Up @@ -339,6 +340,7 @@ class BytesLoggerFactory:
.. versionadded:: 20.2.0
"""

__slots__ = ("_file",)

def __init__(self, file: BinaryIO | None = None):
Expand Down
6 changes: 3 additions & 3 deletions src/structlog/contextvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
STRUCTLOG_KEY_PREFIX = "structlog_"
STRUCTLOG_KEY_PREFIX_LEN = len(STRUCTLOG_KEY_PREFIX)

_ASYNC_CALLING_STACK: contextvars.ContextVar[
FrameType
] = contextvars.ContextVar("_ASYNC_CALLING_STACK")
_ASYNC_CALLING_STACK: contextvars.ContextVar[FrameType] = (
contextvars.ContextVar("_ASYNC_CALLING_STACK")
)

# For proper isolation, we have to use a dict of ContextVars instead of a
# single ContextVar with a dict.
Expand Down
1 change: 1 addition & 0 deletions src/structlog/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class CapturingLoggerFactory:
.. versionadded:: 20.2.0
"""

logger: CapturingLogger

def __init__(self) -> None:
Expand Down
14 changes: 8 additions & 6 deletions src/structlog/tracebacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ def extract(
filename=filename or "?",
lineno=line_no,
name=frame_summary.f_code.co_name,
locals={
key: to_repr(value, max_string=locals_max_string)
for key, value in frame_summary.f_locals.items()
}
if show_locals
else None,
locals=(
{
key: to_repr(value, max_string=locals_max_string)
for key, value in frame_summary.f_locals.items()
}
if show_locals
else None
),
)
append(frame)

Expand Down
5 changes: 3 additions & 2 deletions src/structlog/twisted.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ class EventAdapter:

def __init__(
self,
dictRenderer: Callable[[WrappedLogger, str, EventDict], str]
| None = None,
dictRenderer: (
Callable[[WrappedLogger, str, EventDict], str] | None
) = None,
) -> None:
self._dictRenderer = dictRenderer or _BUILTIN_DEFAULT_PROCESSORS[-1]

Expand Down
15 changes: 5 additions & 10 deletions src/structlog/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ class ExceptionTransformer(Protocol):
.. versionadded:: 22.1.0
"""

def __call__(self, exc_info: ExcInfo) -> Any:
...
def __call__(self, exc_info: ExcInfo) -> Any: ...


@runtime_checkable
Expand All @@ -131,17 +130,13 @@ class BindableLogger(Protocol):

_context: Context

def bind(self, **new_values: Any) -> BindableLogger:
...
def bind(self, **new_values: Any) -> BindableLogger: ...

def unbind(self, *keys: str) -> BindableLogger:
...
def unbind(self, *keys: str) -> BindableLogger: ...

def try_unbind(self, *keys: str) -> BindableLogger:
...
def try_unbind(self, *keys: str) -> BindableLogger: ...

def new(self, **new_values: Any) -> BindableLogger:
...
def new(self, **new_values: Any) -> BindableLogger: ...


class FilteringBoundLogger(BindableLogger, Protocol):
Expand Down

0 comments on commit 5c3bc79

Please sign in to comment.