Skip to content

Commit cb7c25f

Browse files
committed
refactor: Clean up __all__ exports and improve code formatting
1 parent e0ab64f commit cb7c25f

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

logguard/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
__version__: Final[str] = "0.1.0"
6161

6262
__all__ = [
63-
# Assertions & helpers
6463
"ASSERT",
6564
"ASSERT_EQUALS",
6665
"ASSERT_IN",
@@ -69,8 +68,8 @@
6968
"ASSERT_NOT_NONE",
7069
"ASSERT_RANGE",
7170
"ASSERT_TYPE",
72-
# Exceptions
7371
"AppBaseError",
72+
"AppLogger",
7473
"AuthenticationError",
7574
"ConfigurationError",
7675
"DataFormatError",
@@ -84,9 +83,6 @@
8483
"ResourceNotFoundError",
8584
"RetryableError",
8685
"ValidationError",
87-
# Logger
88-
"AppLogger",
89-
# Submodules (explicit access)
9086
"asserts",
9187
"enforce",
9288
"exceptions",

logguard/asserts.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ def _default_failure_handler(
6565
context_dict = dict(extra)
6666

6767
# Add assertion-specific context
68-
context_dict.update({
69-
"expression": expression,
70-
"file": short_file,
71-
"line": line,
72-
"function": function,
73-
})
68+
context_dict.update(
69+
{
70+
"expression": expression,
71+
"file": short_file,
72+
"line": line,
73+
"function": function,
74+
}
75+
)
7476

7577
# Log the error in a single line for better scannability
7678
error_message = " ".join(main_parts) + extra_str

logguard/exceptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
- Useful messages and additional context
2525
- More precise logging and monitoring
2626
27-
Note: You can expand this hierarchy with more specific exceptions as needed. Built-in exceptions are still in work.
27+
Note: You can expand this hierarchy with more specific exceptions as needed.
28+
Built-in exceptions are still in work.
2829
"""
2930

3031
from typing import Any, Optional, Union

logguard/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def resolve_level(value: Union[str, int], default: int) -> int:
180180
# Optionally add JSON-formatted logging (requires python-json-logger package)
181181
if json_logs:
182182
try:
183-
from pythonjsonlogger.json import JsonFormatter # type: ignore[import-not-found]
183+
from pythonjsonlogger.json import JsonFormatter
184184

185185
json_file = str(log_path.with_suffix(".json"))
186186
json_handler = RotatingFileHandler(

0 commit comments

Comments
 (0)