File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class Resolver(NamedTuple):
1717 ip : str = None
1818
1919
20- def add (ips ) -> int :
20+ def add (ips : tuple [ str ] ) -> None :
2121 """Add a DNS (a DNS object) to the dns database."""
2222 with ShecanConfig () as config :
2323 config .update (ips )
@@ -42,7 +42,7 @@ def current_dns() -> list[Resolver]:
4242 if sys .platform == "linux" :
4343 with open ("/etc/resolv.conf" ) as resovl_file :
4444 for line in resovl_file :
45- line = line .strip ()
45+ line = line .strip () # noqa: PLW2901
4646 if not line or line .startswith ("#" ):
4747 continue
4848 resolv_list .append (Resolver (* line .split ()[:2 ]))
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def list_dns() -> None:
3434 print (tabulate (dns_servers , headers = ["ID" , "IP" ], stralign = "center" ))
3535
3636
37- def update_resolv_file (content ) -> None :
37+ def update_resolv_file (content : list [ str ] ) -> None :
3838 resolv_file = Path ("/etc" , "resolv.conf" )
3939 tmp_resolv_file = Path (gettempdir ()).joinpath ("resolv.conf" )
4040
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def __enter__(self) -> Self:
3030 self ._read_config ()
3131 return self
3232
33- def __exit__ (self , * exceptions ) :
33+ def __exit__ (self , * exceptions : object ) -> None :
3434 with open (self .config_file , mode = "w" ) as fp :
3535 self ._parser .write (fp )
3636
Original file line number Diff line number Diff line change 11import logging
2- from typing import Any
2+ from argparse import Namespace
33
44
5- def setup_logging (args : Any ) -> logging .StreamHandler :
5+ def setup_logging (args : Namespace ) -> logging .StreamHandler :
66 console_handhler = logging .StreamHandler ()
77 formatter = logging .Formatter ("%(asctime)s %(levelname)s: %(message)s" )
88 console_handhler .setFormatter (formatter )
You can’t perform that action at this time.
0 commit comments