The api_versions list is first stripped and then converted to integer.
Combining the two operations.

Signed-off-by: Guido Trotter <[email protected]>
---
 lib/backend.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index b19b401..01fd28d 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1495,9 +1495,8 @@ def _OSOndiskAPIVersion(name, os_dir):
     return False, ("Error while reading the API version file at %s: %s" %
                    (api_file, _ErrnoOrStr(err)))
 
-  api_versions = [version.strip() for version in api_versions]
   try:
-    api_versions = [int(version) for version in api_versions]
+    api_versions = [int(version.strip()) for version in api_versions]
   except (TypeError, ValueError), err:
     return False, ("API version(s) can't be converted to integer: %s" %
                    str(err))
-- 
1.5.6.5

Reply via email to