diff --git a/os_apply_config/apply_config.py b/os_apply_config/apply_config.py index affc5a4..324d1d8 100755 --- a/os_apply_config/apply_config.py +++ b/os_apply_config/apply_config.py @@ -89,7 +89,7 @@ def _extract_key(config_path, key, fallback_metadata=None): raise TypeError() except (KeyError, TypeError): try: - if type(config) == list: + if isinstance(config, list): config = config[int(key)] continue except (IndexError, ValueError): @@ -150,7 +150,7 @@ def write_file(path, obj): d = os.path.dirname(path) os.path.exists(d) or os.makedirs(d) with tempfile.NamedTemporaryFile(dir=d, delete=False) as newfile: - if type(obj.body) == str: + if isinstance(obj.body, str): obj.body = obj.body.encode('utf-8') newfile.write(obj.body) os.chmod(newfile.name, mode) diff --git a/os_apply_config/collect_config.py b/os_apply_config/collect_config.py index 08f8e20..35136ba 100644 --- a/os_apply_config/collect_config.py +++ b/os_apply_config/collect_config.py @@ -26,7 +26,7 @@ def read_configs(config_files): if os.path.exists(input_path): try: with open(input_path) as input_file: - yield((input_file.read(), input_path)) + yield (input_file.read(), input_path) except IOError as e: raise exc.ConfigException('Could not open %s for reading. %s' % (input_path, e)) @@ -36,7 +36,7 @@ def parse_configs(config_data): '''Generator yields parsed json for each item passed in config_data.''' for input_data, input_path in config_data: try: - yield(json.loads(input_data)) + yield json.loads(input_data) except ValueError: raise exc.ConfigException('Could not parse metadata file: %s' % input_path) diff --git a/test-requirements.txt b/test-requirements.txt index 391f611..fa85bc0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -hacking>=4.0.0,<4.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD