Skip to content

Commit

Permalink
Remove usage of dict merge operator for py3.7 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
joajfreitas committed Aug 23, 2024
1 parent c3354ff commit 47b2250
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/fcp/v2_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def convert_params(params):

values = {}
for name, value in params.items():
values = values | convertion_table[name](value)
values.update(convertion_table[name](value))

return values

Expand Down Expand Up @@ -566,7 +566,7 @@ def deduplicate(module):
def merge(fcp, fpi):
fcp = {key: fcp[key] for key in fcp.keys() & {"struct", "enum"}}
fpi = {key: fpi[key] for key in fpi.keys() & {"device", "broadcast", "log"}}
fcp = fcp | fpi
fcp.update(fpi)
return Ok(fcp)


Expand All @@ -587,7 +587,7 @@ def convert(module):
def get_sources(module):
sources = {module.filename: module.source}
for mod in module.imports:
sources = sources | get_sources(mod)
sources.update(get_sources(mod))

return sources

Expand Down Expand Up @@ -625,4 +625,5 @@ def get_fcp(fcp, fpi):
fpi_sources = get_sources(fpi)
fpi = deduplicate(resolve_imports(fpi).Q()).Q()

return Ok((convert(merge(fcp, fpi).Q()), fcp_sources | fpi_sources))
fcp_sources.update(fpi_sources)
return Ok((convert(merge(fcp, fpi).Q()), fcp_sources))

0 comments on commit 47b2250

Please sign in to comment.