Skip to content

Commit c7c4951

Browse files
committed
Format code with Black
1 parent 08674a9 commit c7c4951

5 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/syslogcef/cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def main(argv: Iterable[str] | None = None) -> int:
103103
mapping = OverrideMapping(base_mapping, overrides)
104104

105105
input_iter = open_input(args.input, watch=args.watch)
106-
output_stream = (
107-
sys.stdout if args.output == "-" else open(args.output, "w", encoding="utf-8")
108-
)
106+
output_stream = sys.stdout if args.output == "-" else open(args.output, "w", encoding="utf-8")
109107

110108
executor: Executor | None = None
111109
if args.workers and args.workers > 1:

src/syslogcef/converters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def parse_syslog(line: str, *, default_tz: tzinfo | None = None) -> ParsedSyslog
2626
return _parse_syslog(line, default_tz=default_tz)
2727

2828

29-
def from_json(
30-
event: MappingABC[str, Any], *, default_tz: tzinfo | None = None
31-
) -> ParsedEvent:
29+
def from_json(event: MappingABC[str, Any], *, default_tz: tzinfo | None = None) -> ParsedEvent:
3230
timestamp = _parse_timestamp(event)
3331
if timestamp:
3432
timestamp = ensure_tz(timestamp, default_tz)

src/syslogcef/mappings/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class MappingResult:
2222
class Mapping(Protocol):
2323
name: str
2424

25-
def map(self, event: ParsedEvent) -> MappingResult:
26-
...
25+
def map(self, event: ParsedEvent) -> MappingResult: ...
2726

2827

2928
class BaseMapping:

tests/test_cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ def test_cli_mapping_override(tmp_path, capsys, monkeypatch):
2121
with mapping_file.open("w", encoding="utf-8") as handle:
2222
json.dump({"cs2Label": "custom"}, handle)
2323
monkeypatch.setattr("sys.stdin", io.StringIO("not syslog\n"))
24-
exit_code = cli.main([
25-
"--source",
26-
"default",
27-
"--mapping-file",
28-
str(mapping_file),
29-
])
24+
exit_code = cli.main(
25+
[
26+
"--source",
27+
"default",
28+
"--mapping-file",
29+
str(mapping_file),
30+
]
31+
)
3032
captured = capsys.readouterr()
3133
assert exit_code == 0
3234
assert "cs2Label=custom" in captured.out

tests/test_parsing.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ def test_parse_rfc3164_line():
1616

1717

1818
def test_parse_rfc5424_line():
19-
line = (
20-
"<134>1 2023-02-01T12:34:56Z host app 1234 - [exampleSDID@32473 foo=\"bar\"] message"
21-
)
19+
line = '<134>1 2023-02-01T12:34:56Z host app 1234 - [exampleSDID@32473 foo="bar"] message'
2220
parsed = parse_syslog(line)
2321
assert parsed.version == 1
2422
assert parsed.structured_data["exampleSDID@32473"]["foo"] == "bar"

0 commit comments

Comments
 (0)