format by black and isort
This commit is contained in:
+3
-2
@@ -1,8 +1,8 @@
|
|||||||
import cProfile
|
import cProfile
|
||||||
from typing import Optional
|
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
Node = tuple[int, int, int] # только аннотация
|
Node = tuple[int, int, int]
|
||||||
|
|
||||||
|
|
||||||
def get_data(input_file):
|
def get_data(input_file):
|
||||||
@@ -27,6 +27,7 @@ def sort_nodes(nodes: Iterator[Node]) -> list[Node]:
|
|||||||
def data_to_nodes(data: Iterator[str]) -> Iterator[Node]:
|
def data_to_nodes(data: Iterator[str]) -> Iterator[Node]:
|
||||||
return map(cidr4_to_node, data)
|
return map(cidr4_to_node, data)
|
||||||
|
|
||||||
|
|
||||||
def get_mask(ip, mask_len) -> int:
|
def get_mask(ip, mask_len) -> int:
|
||||||
mask = ((1 << mask_len) - 1) << (32 - mask_len)
|
mask = ((1 << mask_len) - 1) << (32 - mask_len)
|
||||||
netaddr = ip & mask
|
netaddr = ip & mask
|
||||||
|
|||||||
Reference in New Issue
Block a user