mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-11 02:12:04 +03:00
style: отформатировать validator.py с black
This commit is contained in:
parent
f99a06985e
commit
34a0e193ac
1 changed files with 25 additions and 29 deletions
|
|
@ -9,11 +9,11 @@ import typer
|
|||
|
||||
# Запрещённые префиксы (private, reserved, multicast)
|
||||
FORBIDDEN_PREFIXES: Final = [
|
||||
"127.", # localhost
|
||||
"0.", # current network
|
||||
"10.", # private class A
|
||||
"127.", # localhost
|
||||
"0.", # current network
|
||||
"10.", # private class A
|
||||
"192.168.", # private class C
|
||||
"172.16.", # private class B (начало диапазона)
|
||||
"172.16.", # private class B (начало диапазона)
|
||||
"172.17.",
|
||||
"172.18.",
|
||||
"172.19.",
|
||||
|
|
@ -29,12 +29,12 @@ FORBIDDEN_PREFIXES: Final = [
|
|||
"172.29.",
|
||||
"172.30.",
|
||||
"172.31.",
|
||||
"224.", # multicast
|
||||
"240.", # reserved
|
||||
"::1", # IPv6 localhost
|
||||
"fe80:", # IPv6 link-local
|
||||
"fc00:", # IPv6 unique local
|
||||
"fd00:", # IPv6 unique local
|
||||
"224.", # multicast
|
||||
"240.", # reserved
|
||||
"::1", # IPv6 localhost
|
||||
"fe80:", # IPv6 link-local
|
||||
"fc00:", # IPv6 unique local
|
||||
"fd00:", # IPv6 unique local
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -89,9 +89,7 @@ def validate_bind_address(value: str) -> str:
|
|||
try:
|
||||
ipaddress.ip_address(value)
|
||||
except ValueError:
|
||||
raise typer.BadParameter(
|
||||
f"'{value}' is not a valid IP address for --my-server"
|
||||
)
|
||||
raise typer.BadParameter(f"'{value}' is not a valid IP address for --my-server")
|
||||
|
||||
return value
|
||||
|
||||
|
|
@ -109,7 +107,5 @@ def validate_port(value: int) -> int:
|
|||
typer.BadParameter: Если порт вне диапазона
|
||||
"""
|
||||
if not (1 <= value <= 65535):
|
||||
raise typer.BadParameter(
|
||||
f"Port {value} must be between 1 and 65535"
|
||||
)
|
||||
raise typer.BadParameter(f"Port {value} must be between 1 and 65535")
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue