Skip to content

Commit

Permalink
make code pep8/pylint clean
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Nov 25, 2024
1 parent a93420a commit ba78995
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion generate_action_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 3 additions & 2 deletions tests/vcr_python_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

import fileinput
import os.path

Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit ba78995

Please sign in to comment.