Skip to content

Commit 4c8279c

Browse files
committed
ruff: reformat
1 parent ce383f6 commit 4c8279c

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

bpf_to_kafka.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def _shutdown(sig: int, _: object) -> None:
2727
signal.signal(signal.SIGINT, _shutdown)
2828
signal.signal(signal.SIGTERM, _shutdown)
2929

30-
print(f"Tracing TCP connects to port {args.port} -> {args.topic}@{args.bootstrap_servers}")
30+
print(
31+
f"Tracing TCP connects to port {args.port} -> {args.topic}@{args.bootstrap_servers}"
32+
)
3133
for event in source.events():
3234
sink.write(event)
3335

tests/unit/test_bpf_source.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
from sources.bpf import TASK_COMM_LEN, _PAYLOAD_LEN, BpfEventSource, _BpfEvent
88

99

10-
def _make_raw(
11-
ts: int, pid: int, comm: bytes, payload: bytes
12-
) -> _BpfEvent:
10+
def _make_raw(ts: int, pid: int, comm: bytes, payload: bytes) -> _BpfEvent:
1311
e = _BpfEvent()
1412
e.ts = ts
1513
e.pid = pid
@@ -43,7 +41,10 @@ def test_yields_event_from_perf_buffer() -> None:
4341
source = _source_with_events([raw])
4442
(event,) = islice(source.events(), 1)
4543
assert event == Event(
46-
timestamp=1_000_000_000, pid=1234, process="bash", payload="tcp_connect port=443"
44+
timestamp=1_000_000_000,
45+
pid=1234,
46+
process="bash",
47+
payload="tcp_connect port=443",
4748
)
4849

4950

tests/unit/test_debug_bpf_source.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def _source_with_rows(
2020

2121

2222
def test_yields_event_from_trace_fields() -> None:
23-
source = _source_with_rows(
24-
[_make_row(b"bash", 1234, 1.0, b"execve /bin/ls")]
25-
)
23+
source = _source_with_rows([_make_row(b"bash", 1234, 1.0, b"execve /bin/ls")])
2624
events = list(source.events())
2725
assert events == [
28-
Event(timestamp=1_000_000_000, pid=1234, process="bash", payload="execve /bin/ls")
26+
Event(
27+
timestamp=1_000_000_000, pid=1234, process="bash", payload="execve /bin/ls"
28+
)
2929
]
3030

3131

@@ -63,7 +63,9 @@ def test_skips_row_with_non_decodable_task() -> None:
6363

6464
def test_skips_row_with_invalid_pid() -> None:
6565
mock_bpf = MagicMock()
66-
mock_bpf.trace_fields.return_value = iter([(b"proc", "not-an-int", 0, 0, 1.0, b"msg")])
66+
mock_bpf.trace_fields.return_value = iter(
67+
[(b"proc", "not-an-int", 0, 0, 1.0, b"msg")]
68+
)
6769
source = DebugBpfEventSource(mock_bpf)
6870
assert list(source.events()) == []
6971

0 commit comments

Comments
 (0)