Skip to content

Commit

Permalink
fix possible use before assignment errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed May 19, 2024
1 parent f9aa0af commit b35bf85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions oresat_configs/_yaml_to_od.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,13 @@ def _gen_c3_fram_defs(c3_od: ObjectDictionary, config: CardConfig) -> list[Varia
fram_objs = []

for fields in config.fram:
obj = None
if len(fields) == 1:
obj = c3_od[fields[0]]
elif len(fields) == 2:
obj = c3_od[fields[0]][fields[1]]
fram_objs.append(obj)
if obj is not None:
fram_objs.append(obj)

return fram_objs

Expand All @@ -679,11 +681,13 @@ def _gen_c3_beacon_defs(c3_od: ObjectDictionary, beacon_def: BeaconConfig) -> li
beacon_objs = []

for fields in beacon_def.fields:
obj = None
if len(fields) == 1:
obj = c3_od[fields[0]]
elif len(fields) == 2:
obj = c3_od[fields[0]][fields[1]]
beacon_objs.append(obj)
if obj is not None:
beacon_objs.append(obj)

return beacon_objs

Expand Down

0 comments on commit b35bf85

Please sign in to comment.