fix: Make mypy happy, few syntax changes
parent
b9239ae3d0
commit
21004dc888
|
@ -8,10 +8,10 @@ import sys
|
|||
from collections.abc import Mapping
|
||||
from contextlib import suppress
|
||||
from glob import glob
|
||||
from ipaddress import ip_network, IPv6Address, IPv4Address, IPv4Network, IPv6Network, _BaseNetwork, \
|
||||
from ipaddress import ip_network, IPv6Address, IPv4Address, IPv4Network, _BaseNetwork, \
|
||||
AddressValueError, NetmaskValueError
|
||||
from pathlib import Path
|
||||
from typing import Union, Dict, Any, List, Optional, Tuple
|
||||
from typing import Union, Dict, Any, List, Optional, Tuple, Sequence
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from . import tools
|
||||
|
@ -32,7 +32,6 @@ def json_default(obj: 'WarningList') -> Union[Dict, str]:
|
|||
return obj.to_dict()
|
||||
|
||||
|
||||
|
||||
class WarningList():
|
||||
|
||||
expected_types = ['string', 'substring', 'hostname', 'cidr', 'regex']
|
||||
|
@ -212,7 +211,7 @@ def compile_network_filters(values: list) -> Tuple[NetworkFilter, NetworkFilter]
|
|||
return ipv4_filter, ipv6_filter
|
||||
|
||||
|
||||
def convert_networks(values: list) -> List[_BaseNetwork]:
|
||||
def convert_networks(values: list) -> Sequence[_BaseNetwork]:
|
||||
valid_ips = []
|
||||
invalid_ips = []
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ class TestPyMISPWarningLists(unittest.TestCase):
|
|||
|
||||
|
||||
class TestCidrList(unittest.TestCase):
|
||||
|
||||
cidr_list: WarningList
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.cidr_list = WarningList(
|
||||
|
|
Loading…
Reference in New Issue