Skip to content

Commit a5d7d74

Browse files
authored
Merge pull request #27 from redb0/fix-style
Correction of stylistic errors and typos
2 parents 5eb1fd3 + a3f4256 commit a5d7d74

8 files changed

Lines changed: 24 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Fix
88

9-
- **middleware**: sefe receipt of response status
9+
- **middleware**: safe receipt of response status
1010
- **base_formatter**: make `in_file` to keyword-only argument.
1111

1212
## 0.6.1 (2025-02-18)
@@ -92,7 +92,7 @@
9292

9393
### Fix
9494

95-
- **all**: add logger name, level in model, message chenge to json
95+
- **all**: add logger name, level in model, message change to json
9696

9797
## 0.3.4 (2024-07-22)
9898

docs_src/example_2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import AsyncGenerator
12
from contextlib import asynccontextmanager
23
from typing import Any
34

@@ -20,7 +21,7 @@ class Settings(BaseSettingsModel):
2021

2122

2223
@asynccontextmanager
23-
async def lifespan(_: FastAPI):
24+
async def lifespan(_: FastAPI) -> AsyncGenerator[Any, Any]:
2425
queue_listener = setup_logger(settings.log)
2526

2627
if queue_listener:

docs_src/example_8.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import AsyncGenerator
22
from contextlib import asynccontextmanager
3-
from typing import Optional
3+
from typing import Annotated, Optional
44

55
from fastapi import FastAPI, Query, Request
66
from starlette.middleware import Middleware
@@ -120,9 +120,9 @@ async def test(request: Request) -> str:
120120
def foo(
121121
item_id: int,
122122
item: dict[str, str],
123-
bar: str = Query(),
124-
password: str = Query(),
125-
baz: str = Query(),
123+
bar: Annotated[str, Query()],
124+
password: Annotated[str, Query()],
125+
baz: Annotated[str, Query()],
126126
) -> dict[str, str]:
127127
return item | {'item_id': str(item_id), 'bar': bar, 'password': password, 'baz': baz}
128128

fastapi_structlog/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ def setup_logger( # noqa: PLR0913
9696

9797

9898
__all__ = (
99+
'BaseSettingsModel',
100+
'DatabaseHandlerFactory',
101+
'FileHandlerFactory',
102+
'HandlerFactory',
99103
'LogSettings',
100104
'LogType',
101-
'setup_logger',
102105
'LoggerConfigurator',
103-
'DatabaseHandlerFactory',
104-
'SyslogHandlerFactory',
105106
'StreamHandlerFactory',
106-
'FileHandlerFactory',
107-
'HandlerFactory',
107+
'SyslogHandlerFactory',
108108
'base_formatter',
109-
'BaseSettingsModel',
109+
'setup_logger',
110110
)

fastapi_structlog/db_handler/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from fastapi_structlog.db_handler.model import LogModel
33

44
__all__ = (
5-
'LogModel',
6-
'QueueHandler',
75
'BaseDatabaseHandler',
86
'DatabaseHandler',
7+
'LogModel',
8+
'QueueHandler',
99
)

fastapi_structlog/log.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ def configure_structlog(logger: str, processors: list[Processor]) -> None:
207207
)
208208

209209

210-
def base_formatter(settings: LogSettings, *, in_file=False) -> structlog.stdlib.ProcessorFormatter:
210+
def base_formatter(
211+
settings: LogSettings,
212+
*,
213+
in_file: bool=False,
214+
) -> structlog.stdlib.ProcessorFormatter:
211215
"""Create a basic formatter based on the configuration."""
212216
shared_processors = configure_processor(
213217
json_logs=settings.json_logs,

fastapi_structlog/sentry/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .settings import Environment, SentrySettings
88

99
__all__ = (
10-
'setup_sentry',
11-
'SentrySettings',
1210
'Environment',
11+
'SentrySettings',
12+
'setup_sentry',
1313
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ line-length = 100
135135
keep-runtime-typing = true
136136

137137
[tool.ruff.lint.per-file-ignores]
138-
"docs_src/*" = ["D100", "D101", "D103", "T201", "S104"]
138+
"docs_src/*" = ["D100", "D101", "D103", "T201", "S104", "INP001", "ERA001", "G004"]
139139

140140

141141
[tool.ruff.lint.flake8-quotes]

0 commit comments

Comments
 (0)