Skip to content

Commit

Permalink
fix pylint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Jun 24, 2018
1 parent 55bd487 commit 0378d9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ZanataArgParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand All @@ -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
2 changes: 1 addition & 1 deletion ZanataFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions testZanataArgParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 0378d9e

Please sign in to comment.