Apply suggestions from code review

Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
This commit is contained in:
Uriel
2026-03-09 13:55:34 -03:00
committed by GitHub
parent aff006a85f
commit 805b978403

View File

@@ -193,7 +193,7 @@ class GameRangePorts(typing.NamedTuple):
@functools.cache
def parse_game_ports(game_ports: tuple[str | int, ...]) -> GameRangePorts:
parsed_ports: list[range] = []
weights = []
weights: list[int] = []
ephemeral_allowed = False
total_length = 0
@@ -247,13 +247,13 @@ def try_conns_per_process(p: psutil.Process) -> typing.Iterable[int]:
try:
return map(lambda c: c.laddr.port, p.net_connections("tcp4"))
except psutil.AccessDenied:
return []
return ()
def get_active_net_connections() -> typing.Iterable[int]:
# Don't even try to check if system using AIX
if psutil._common.AIX:
return []
if psutil.AIX:
return ()
try:
return map(lambda c: c.laddr.port, psutil.net_connections("tcp4"))