From 6e0b1f4d2b30f31d628f8ffb0ae71f8e6a2452f6 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 3 Mar 2015 01:03:28 +0300 Subject: [PATCH] removed excessive call to os.path.exists os.path.isfile checks for existance anyway so there is no point in checking both isfile and exists Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3 --- glanceclient/v2/shell.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py index b405bcf7..f3838654 100644 --- a/glanceclient/v2/shell.py +++ b/glanceclient/v2/shell.py @@ -28,7 +28,7 @@ def get_image_schema(): global IMAGE_SCHEMA if IMAGE_SCHEMA is None: schema_path = expanduser("~/.glanceclient/image_schema.json") - if os.path.exists(schema_path) and os.path.isfile(schema_path): + if os.path.isfile(schema_path): with open(schema_path, "r") as f: schema_raw = f.read() IMAGE_SCHEMA = json.loads(schema_raw) @@ -356,7 +356,7 @@ def get_namespace_schema(): global NAMESPACE_SCHEMA if NAMESPACE_SCHEMA is None: schema_path = expanduser("~/.glanceclient/namespace_schema.json") - if os.path.exists(schema_path) and os.path.isfile(schema_path): + if os.path.isfile(schema_path): with open(schema_path, "r") as f: schema_raw = f.read() NAMESPACE_SCHEMA = json.loads(schema_raw) @@ -495,7 +495,7 @@ def get_resource_type_schema(): global RESOURCE_TYPE_SCHEMA if RESOURCE_TYPE_SCHEMA is None: schema_path = expanduser("~/.glanceclient/resource_type_schema.json") - if os.path.exists(schema_path) and os.path.isfile(schema_path): + if os.path.isfile(schema_path): with open(schema_path, "r") as f: schema_raw = f.read() RESOURCE_TYPE_SCHEMA = json.loads(schema_raw)