diff --git a/ZanataArgParser.py b/ZanataArgParser.py index fb82c5a..b4acf95 100755 --- a/ZanataArgParser.py +++ b/ZanataArgParser.py @@ -137,13 +137,14 @@ def parse_env(self, args=None): # type: (argparse.Namespace) -> dict """Parse environment""" result = {} - for env_name, env_data in self.env_def.iteritems(): + for env_name in self.env_def: + env_data = self.env_def[env_name] env_value = os.environ.get(env_name) try: if not ZanataArgParser.is_env_valid( env_name, env_value, env_data, args): continue - except AssertionError, e: # NOQA + except AssertionError as e: raise e if not env_value: if env_data['required']: @@ -160,6 +161,6 @@ def parse_all(self, args=None, namespace=None): """Parse arguments and environment""" result = self.parse_args(args, namespace) env_dict = self.parse_env(result) - for k, v in env_dict.iteritems(): + for k, v in env_dict.iteritems(): # pylint: disable=no-member setattr(result, k, v) return result diff --git a/ZanataFunctions.py b/ZanataFunctions.py index 4b52d8b..adf2bd2 100755 --- a/ZanataFunctions.py +++ b/ZanataFunctions.py @@ -12,7 +12,7 @@ import sys import urllib2 # noqa: F401 # pylint: disable=import-error import urlparse # noqa: F401 # pylint: disable=import-error -from ZanataArgParser import ZanataArgParser +from ZanataArgParser import ZanataArgParser # pylint: disable=import-error try: from typing import List, Any # noqa: F401 # pylint: disable=unused-import diff --git a/testZanataArgParser.py b/testZanataArgParser.py index ae9b816..e4dd8a7 100755 --- a/testZanataArgParser.py +++ b/testZanataArgParser.py @@ -14,7 +14,7 @@ def _convert_unicode_str(dictionary): """Recursively converts dictionary keys to strings""" if not isinstance(dictionary, dict): - if isinstance(dictionary, unicode): # NOQA + if isinstance(dictionary, unicode): # NOQA # pylint: disable=E0602 return str(dictionary) return str(dictionary) return dict( @@ -44,7 +44,7 @@ def _match_result( args = getattr(self.parser, method)(param_list) sys.stdout = sys.__stdout__ if stdout_pattern: - self.assertRegexpMatches( + self.assertRegexpMatches( # pylint: disable=W1505 captured_output.getvalue(), stdout_pattern) self.assertDictEqual( _convert_unicode_str(expected_args),