1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

modify some shell scripts to make variable references safer; modify some python scripts to reduce the code complexity and cyclomatic complexity of functions.

This commit is contained in:
herengui 2022-08-22 09:57:07 +08:00
parent aaea1d9451
commit 4d78917c35
12 changed files with 164 additions and 262 deletions

View file

@ -181,10 +181,7 @@ class IPint(object):
if isinstance(data, INT_TYPES):
self.ip = int(data)
if ipversion == 0:
if self.ip <= MAX_IPV4_ADDRESS:
ipversion = 4
else:
ipversion = 6
ipversion = 4 if self.ip <= MAX_IPV4_ADDRESS else 6
if ipversion == 4:
if self.ip > MAX_IPV4_ADDRESS:
raise ValueError("IPv4 Address can't be larger than %x: %x" % (MAX_IPV4_ADDRESS, self.ip))