From 4200c6ccc0d25ad1d231614e2758c294653c84dd Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Mon, 9 May 2016 11:38:56 -0400 Subject: [PATCH] Refactor confusing code in custom_guidelines.py Change-Id: Iae7efbb8fe4157301deebd0776139489832f470f --- tools/custom_guidelines.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/custom_guidelines.py b/tools/custom_guidelines.py index 5356ed6446..81e0569751 100644 --- a/tools/custom_guidelines.py +++ b/tools/custom_guidelines.py @@ -33,15 +33,15 @@ class HeatCustomGuidelines(object): global_env = resources.global_env() for resource_type in global_env.get_types(): cls = global_env.get_class(resource_type) + module = cls.__module__ # Skip resources, which defined as template resource in environment - if cls.__module__ == 'heat.engine.resources.template_resource': + if module == 'heat.engine.resources.template_resource': continue # Skip discovered plugin resources - if cls.__module__ == 'heat.engine.plugins': + if module == 'heat.engine.plugins': continue - if (lambda module: True - if [path for path in exclude if path in module] - else False)(cls.__module__.replace('.', '/')): + path = module.replace('.', '/') + if any(path.startswith(excl_path) for excl_path in exclude): continue self.resources_classes.append(cls)