Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed Aug 9, 2024
1 parent e2bf5d6 commit 7f1c7f4
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions sdks/python/apache_beam/yaml/readme_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ def test(self):

def parse_test_methods(markdown_lines):
# pylint: disable=too-many-nested-blocks

def extract_inputs(input_spec):
if not input_spec:
return set()
elif isinstance(input_spec, str):
return set([input_spec.split('.')[0]])
elif isinstance(input_spec, list):
return set.union(*[extract_inputs(v) for v in input_spec])
elif isinstance(input_spec, dict):
return set.union(*[extract_inputs(v) for v in input_spec.values()])
else:
raise ValueError("Misformed inputs: " + input_spec)

def extract_name(input_spec):
return input_spec.get('name', input_spec.get('type'))

code_lines = None
for ix, line in enumerate(markdown_lines):
line = line.rstrip()
Expand All @@ -287,23 +303,6 @@ def parse_test_methods(markdown_lines):
if is_chain:
undefined_inputs = set(['input'])
else:

def extract_inputs(input_spec):
if not input_spec:
return set()
elif isinstance(input_spec, str):
return set([input_spec.split('.')[0]])
elif isinstance(input_spec, list):
return set.union(*[extract_inputs(v) for v in input_spec])
elif isinstance(input_spec, dict):
return set.union(
*[extract_inputs(v) for v in input_spec.values()])
else:
raise ValueError("Misformed inputs: " + input_spec)

def extract_name(input_spec):
return input_spec.get('name', input_spec.get('type'))

undefined_inputs = set.union(
*[extract_inputs(spec.get('input')) for spec in specs]) - set(
extract_name(spec) for spec in specs)
Expand Down

0 comments on commit 7f1c7f4

Please sign in to comment.