diff --git a/generate_action_groups.py b/generate_action_groups.py index 34fee937..f4dbd260 100644 --- a/generate_action_groups.py +++ b/generate_action_groups.py @@ -11,4 +11,4 @@ runtime['action_groups']['foreman'] = sorted(set(ALL_MODULES) - set(EXCLUDED_MODULES)) with open(META_RUNTIME, 'w') as runtime_file: - yaml.safe_dump(runtime, runtime_file, default_flow_style=False, explicit_start=True) + yaml.safe_dump(runtime, runtime_file, default_flow_style=False, explicit_start=True) diff --git a/tests/vcr_python_wrapper.py b/tests/vcr_python_wrapper.py index 76a35fda..136fc192 100755 --- a/tests/vcr_python_wrapper.py +++ b/tests/vcr_python_wrapper.py @@ -27,7 +27,8 @@ def body_json_l2_matcher(r1, r2): body1 = json.loads(r1.body.decode('utf8')) body2 = json.loads(r2.body.decode('utf8')) if 'common_parameter' in body1 and 'common_parameter' in body2: - if body1['common_parameter'].get('parameter_type') == body2['common_parameter'].get('parameter_type') in ['hash', 'json', 'yaml']: + if (body1['common_parameter'].get('parameter_type') == body2['common_parameter'].get('parameter_type') + and body1['common_parameter'].get('parameter_type') in ['hash', 'json', 'yaml']): body1['common_parameter']['value'] = json.loads(body1['common_parameter'].get('value')) body2['common_parameter']['value'] = json.loads(body2['common_parameter'].get('value')) assert body1 == body2, "{} != {}".format(body1, body2) @@ -39,7 +40,7 @@ def body_json_l2_matcher(r1, r2): body2 = sorted(r2.body.replace(b'~', b'%7E').split(b'&')) assert len(body1) == len(body2), "the body lengths don't match" for i, v in enumerate(body1): - assert body1[i] == body2[i], "body contents at position {} dont't match: '{}' vs '{}'".format(i, body1[i], body2[i]) + assert body1[i] == body2[i], "body contents at position {} dont't match: '{}' vs '{}'".format(i, body1[i], body2[i]) # pylint:disable=all else: assert r1.body == r2.body, "{} != {}".format(r1.body, r2.body) diff --git a/vendor.py b/vendor.py index e6128d8c..b0f19984 100644 --- a/vendor.py +++ b/vendor.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - import fileinput import os.path @@ -53,8 +51,10 @@ elif line in ['try:', 'if TYPE_CHECKING:'] or buffer_lines: buffer_lines.append(line) if "from typing" in line: - typing_imports.update([element.strip(',') for element in line.split('#')[0].strip().split(' ')[3:] if not element.strip(',') == 'TYPE_CHECKING']) - if ('pass' in line or 'TYPE_CHECKING =' in line or ('from apypie' in line and 'if TYPE_CHECKING:' in buffer_lines)) and ('from typing' in buffer_lines[1] or 'from apypie' in buffer_lines[1]): + typing_imports.update([element.strip(',') for element in line.split('#')[0].strip().split(' ')[3:] + if not element.strip(',') == 'TYPE_CHECKING']) + if (('pass' in line or 'TYPE_CHECKING =' in line or ('from apypie' in line and 'if TYPE_CHECKING:' in buffer_lines)) and + ('from typing' in buffer_lines[1] or 'from apypie' in buffer_lines[1])): buffer_lines.clear() elif "from typing" in line: typing_imports.update([element.strip(',') for element in line.split('#')[0].strip().split(' ')[3:] if not element.strip(',') == 'TYPE_CHECKING'])