Convert long to int

- Python 2 only
k = 9223372036854775808L

- Python 2 and 3:
k = 9223372036854775808

See http://python-future.org/compatible_idioms.html#long-integers
This commit is contained in:
Radostin Stoyanov 2017-10-11 12:35:51 +01:00 committed by Cole Robinson
parent 6de65ab328
commit 95c695d774
3 changed files with 4 additions and 4 deletions

View File

@ -467,7 +467,7 @@ class vmmConnect(vmmGObjectUI):
if host.startswith("linux-"):
tmphost = host[6:]
try:
long(tmphost)
int(tmphost)
host = ""
except ValueError:
pass

View File

@ -391,7 +391,7 @@ class CloneStorageCreator(_StorageCreator):
else:
vfs = os.statvfs(os.path.dirname(self._path))
avail = vfs.f_frsize * vfs.f_bavail
need = long(self._size * 1024 * 1024 * 1024)
need = int(self._size) * 1024 * 1024 * 1024
if need > avail:
if self._sparse:
msg = _("The filesystem will not have enough free space"
@ -411,7 +411,7 @@ class CloneStorageCreator(_StorageCreator):
text = (_("Cloning %(srcfile)s") %
{'srcfile': os.path.basename(self._input_path)})
size_bytes = long(self.get_size() * 1024 * 1024 * 1024)
size_bytes = int(self.get_size()) * 1024 * 1024 * 1024
progresscb.start(filename=self._output_path, size=size_bytes,
text=text)

View File

@ -481,7 +481,7 @@ def format_number(number, SI=0, space=' '):
depth = depth + 1
number = number / step
if isinstance(number, int) or isinstance(number, long):
if isinstance(number, int):
# it's an int or a long, which means it didn't get divided,
# which means it's already short enough
fmt = '%i%s%s'