mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Some more changes for the code formatting audit.
This commit is contained in:
parent
6173bedfa7
commit
5e1b85ffb2
@ -171,7 +171,7 @@ def _cidr_to_ipv4_netmask(cidr_bits):
|
||||
netmask += '255'
|
||||
cidr_bits -= 8
|
||||
else:
|
||||
netmask += '%d' % (256-(2**(8-cidr_bits)))
|
||||
netmask += '{0:d}'.format(256-(2**(8-cidr_bits)))
|
||||
cidr_bits = 0
|
||||
return netmask
|
||||
|
||||
|
@ -3,6 +3,7 @@ import sys
|
||||
__version_info__ = (0, 10, 3, 'd')
|
||||
__version__ = '.'.join(map(str, __version_info__))
|
||||
|
||||
|
||||
def versions_report():
|
||||
libs = (
|
||||
("Jinja2", "jinja2", "__version__"),
|
||||
@ -12,14 +13,17 @@ def versions_report():
|
||||
("pycrypto", "Crypto", "__version__"),
|
||||
("PyYAML", "yaml", "__version__"),
|
||||
("PyZMQ", "zmq", "__version__"),
|
||||
|
||||
)
|
||||
|
||||
fmt = "{0:>%d}: {1}" % (len(max([lib[0] for lib in libs], key=len)) + 1)
|
||||
padding = len(max([lib[0] for lib in libs], key=len)) + 1
|
||||
|
||||
yield fmt.format("Salt", __version__)
|
||||
fmt = '{0:>{pad}}: {1}'
|
||||
|
||||
yield fmt.format("Python", sys.version.rsplit('\n')[0].strip())
|
||||
yield fmt.format("Salt", __version__, pad=padding)
|
||||
|
||||
yield fmt.format(
|
||||
"Python", sys.version.rsplit('\n')[0].strip(), pad=padding
|
||||
)
|
||||
|
||||
for name, imp, attr in libs:
|
||||
try:
|
||||
@ -27,9 +31,9 @@ def versions_report():
|
||||
version = getattr(imp, attr)
|
||||
if not isinstance(version, basestring):
|
||||
version = '.'.join(map(str, version))
|
||||
yield fmt.format(name, version)
|
||||
yield fmt.format(name, version, pad=padding)
|
||||
except ImportError:
|
||||
yield fmt.format(name, "not installed")
|
||||
yield fmt.format(name, "not installed", pad=padding)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user