Compare commits

4 Commits

Author SHA1 Message Date
4693cf74b2 use variable name instead of underscore in list comprehension
By convention, in Python we use underscores for "throwaway" variables, for example when unpacking a tuple only a few of whose members we're interested in.
2022-11-02 15:14:51 +01:00
5ed8482dcb Merge pull request #2 from zevaverbach/patch-2
bugfix and shortened a few functions
2022-11-02 15:11:53 +01:00
0a96dff67f Merge pull request #1 from zevaverbach/patch-1
compare boolean result using `is` operator instead of `==`
2022-11-02 15:11:27 +01:00
f937bbe25b compare boolean result using is operator instead of == 2022-11-02 15:03:11 +01:00
2 changed files with 3 additions and 3 deletions

View File

@@ -48,4 +48,4 @@ def hosts_in_subnet(network: str) -> List[str]:
if not is_subnet(network):
print(f"{network} is not a network")
return [str(_) for _ in ipaddress.ip_network(network).hosts()]
return [str(host) for host in ipaddress.ip_network(network).hosts()]

View File

@@ -7,8 +7,8 @@ def test_is_port_open():
def test_is_subnet():
assert pscanner.is_subnet("192.168.1.0") == False
assert pscanner.is_subnet("192.168.0/24") == True
assert pscanner.is_subnet("192.168.1.0") is False
assert pscanner.is_subnet("192.168.0/24") is True
def test_hosts_in_subnet():