Skip to content

Commit 338a08f

Browse files
committed
Update pre-commit hooks
1 parent 9e7cd98 commit 338a08f

6 files changed

Lines changed: 19 additions & 22 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fail_fast: false
88

99
repos:
1010
- repo: "https://github.com/pre-commit/pre-commit-hooks"
11-
rev: "v4.4.0"
11+
rev: "v6.0.0"
1212
hooks:
1313
- id: "check-added-large-files"
1414
- id: "check-case-conflict"
@@ -25,30 +25,30 @@ repos:
2525
- id: "requirements-txt-fixer"
2626
- id: "trailing-whitespace"
2727

28-
- repo: "https://github.com/adrienverge/yamllint.git"
29-
rev: "v1.32.0"
28+
- repo: "https://github.com/adrienverge/yamllint"
29+
rev: "v1.38.0"
3030
hooks:
3131
- id: "yamllint"
3232
args:
3333
- "-c"
3434
- ".yamllint.yml"
3535

3636
- repo: "https://github.com/psf/black"
37-
rev: "25.1.0"
37+
rev: "26.1.0"
3838
hooks:
3939
- id: "black"
4040

4141
- repo: "https://github.com/pycqa/flake8"
42-
rev: "7.2.0"
42+
rev: "7.3.0"
4343
hooks:
4444
- id: "flake8"
4545

4646
- repo: "https://github.com/rhysd/actionlint"
47-
rev: "v1.7.7"
47+
rev: "v1.7.11"
4848
hooks:
4949
- id: "actionlint"
5050

51-
- repo: "https://github.com/fsfe/reuse-tool"
52-
rev: "v5.0.2"
51+
- repo: "https://codeberg.org/fsfe/reuse-tool"
52+
rev: "v6.2.0"
5353
hooks:
5454
- id: "reuse"

2ping

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ from pathlib import Path
1010
from runpy import run_module
1111
import sys
1212

13-
1413
sys.path.insert(0, str(Path(__file__).resolve().parent))
1514
run_module("twoping.cli", run_name="__main__")

twoping/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66

77
import sys
88

9-
109
__version__ = "4.5.1"
1110
assert sys.version_info > (3, 6)

twoping/args.py

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

1616

1717
def _type_nagios(string):
18-
(warn_rta, warn_loss, crit_rta, crit_loss) = string.split(",", 3)
18+
warn_rta, warn_loss, crit_rta, crit_loss = string.split(",", 3)
1919
if (warn_loss[-1:] != "%") or (crit_loss[-1:] != "%"):
2020
raise argparse.ArgumentTypeError(_("Invalid limits"))
2121
return types.SimpleNamespace(
@@ -28,7 +28,7 @@ def _type_nagios(string):
2828

2929
def _type_packet_loss(string):
3030
if ":" in string:
31-
(v_out, v_in) = string.split(":", 1)
31+
v_out, v_in = string.split(":", 1)
3232
else:
3333
v_out = v_in = string
3434
return types.SimpleNamespace(out_pct=float(v_out), in_pct=float(v_in))

twoping/cli.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
stats_time,
4242
)
4343

44-
4544
version_string = "2ping {} - {}".format(__version__, platform_info())
4645
clock = time.perf_counter
4746

@@ -223,7 +222,7 @@ def handle_socket_error(self, e, sock_class, peer_address=None):
223222
error_string = str(e)
224223
try:
225224
MSG_ERRQUEUE = 8192
226-
(error_data, error_address) = sock.recvfrom(16384, MSG_ERRQUEUE)
225+
error_data, error_address = sock.recvfrom(16384, MSG_ERRQUEUE)
227226
print_address = error_address[0]
228227
except socket.error:
229228
if peer_address:
@@ -331,7 +330,7 @@ def process_incoming_packet(self, sock_class):
331330
)
332331
)
333332
return
334-
(test_begin, test_length) = packet_in.opcode_data_positions[packets.OpcodeHMAC.id]
333+
test_begin, test_length = packet_in.opcode_data_positions[packets.OpcodeHMAC.id]
335334
test_begin += 2
336335
test_length -= 2
337336
packet_in.opcodes[packets.OpcodeHMAC.id].key = self.args.auth.encode("UTF-8")
@@ -355,7 +354,7 @@ def process_incoming_packet(self, sock_class):
355354
if packets.OpcodeInReplyTo.id in packet_in.opcodes:
356355
replied_message_id = packet_in.opcodes[packets.OpcodeInReplyTo.id].message_id
357356
if replied_message_id in peer_state.sent_messages:
358-
(sent_time, _unused, ping_position) = peer_state.sent_messages[replied_message_id]
357+
sent_time, _unused, ping_position = peer_state.sent_messages[replied_message_id]
359358
del peer_state.sent_messages[replied_message_id]
360359

361360
calculated_rtt = (time_begin - sent_time) * 1000
@@ -536,7 +535,7 @@ def sock_sendto(self, sock_class, data, address=None):
536535
def sock_recvfrom(self, sock_class):
537536
sock = sock_class.sock
538537
try:
539-
(data, peer_address) = sock.recvfrom(16384)
538+
data, peer_address = sock.recvfrom(16384)
540539
except socket.error as e:
541540
self.handle_socket_error(e, sock_class)
542541
return
@@ -563,7 +562,7 @@ def start_investigations(self, peer_state, packet_check):
563562
iobj = None
564563
now = clock()
565564
for message_id_str in peer_state.sent_messages:
566-
(sent_time, message_id, _unused) = peer_state.sent_messages[message_id_str]
565+
sent_time, message_id, _unused = peer_state.sent_messages[message_id_str]
567566
if now >= (sent_time + self.args.inquire_wait):
568567
if iobj is None:
569568
iobj = packets.OpcodeInvestigate()
@@ -584,7 +583,7 @@ def check_investigations(self, peer_state, packet_check):
584583
for message_id in packet_check.opcodes[opcode_id].message_ids:
585584
if message_id not in peer_state.sent_messages:
586585
continue
587-
(_unused, _unused, ping_seq) = peer_state.sent_messages[message_id]
586+
_unused, _unused, ping_seq = peer_state.sent_messages[message_id]
588587
if peer_state.peer_tuple[1]:
589588
address = peer_state.peer_tuple[1][0]
590589
else:
@@ -601,7 +600,7 @@ def check_investigations(self, peer_state, packet_check):
601600
return
602601
# Print results
603602
for ping_seq in sorted(found):
604-
(loss_type, address) = found[ping_seq]
603+
loss_type, address = found[ping_seq]
605604
if loss_type == "inbound":
606605
loss_message = "Lost inbound packet from {address}: ping_seq={seq}"
607606
else:

twoping/packets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def load(self, data):
330330

331331
def dump(self, max_length=None):
332332
if self.digest_index is not None:
333-
(hasher, size, hasher_name) = self.digest_map[self.digest_index]
333+
hasher, size, hasher_name = self.digest_map[self.digest_index]
334334
return npack(self.digest_index, 2) + bytes(size)
335335
return None
336336

@@ -623,5 +623,5 @@ def dump(self):
623623
return bytes(out)
624624

625625
def calculate_hash(self, opcode, payload):
626-
(hasher, size, hasher_name) = opcode.digest_map[opcode.digest_index]
626+
hasher, size, hasher_name = opcode.digest_map[opcode.digest_index]
627627
return hmac.new(opcode.key, payload, hasher).digest()

0 commit comments

Comments
 (0)