Skip to content

Commit 648edab

Browse files
committed
Fix get_key_value
1 parent a494bf7 commit 648edab

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

readme_builder.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@
3535

3636

3737
def get_key_value(obj, key):
38-
if hasattr(obj,'iteritems'):
39-
for k, v in obj.iteritems():
40-
if k == key:
41-
return v
42-
if isinstance(v, dict):
43-
return get_key_value(v, key)
44-
elif isinstance(v, list):
45-
for d in v:
46-
return get_key_value(d, key)
38+
if isinstance(obj, dict):
39+
if key in obj:
40+
return obj[key]
41+
42+
for k, v in obj.items():
43+
test_value = get_key_value(v, key)
44+
if test_value:
45+
return test_value
46+
47+
if isinstance(obj, list):
48+
for v in obj:
49+
test_value = get_key_value(v, key)
50+
if test_value:
51+
return test_value
52+
53+
54+
os.environ["BUILDER_WORKFLOW_PATH"] = "/Users/rob/Repository/multi-py/python-oso/.github/workflows/image-build.yml"
4755

4856
platform = "linux/amd64,linux/arm64,linux/arm/v7"
4957
variants = ["full", "slim", "alpine"]

0 commit comments

Comments
 (0)