Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dilan Pathirana <[email protected]>
  • Loading branch information
dweindl and dilpath authored Dec 18, 2023
1 parent 9027a86 commit 876b88f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions python/sdist/amici/cxxcodeprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def get_switch_statement(
"""
Generate code for a C++ switch statement.
Generate code for a C++ switch statements with a ``break`` after each case.
Generate code for a C++ switch statement with a ``break`` after each case.
:param condition:
Condition for switch
Expand Down Expand Up @@ -343,12 +343,7 @@ def get_switch_statement(
)
case_code = f"{indent1}case {expression}:"

try:
# there is already a case with the same statement, append
cases_map[statement_code].append(case_code)
except KeyError:
# add new case + statement
cases_map[statement_code] = [case_code]
cases_map[statement_code] = cases_map.get(statement_code, []) + [case_code]

if not cases_map:
return []
Expand Down

0 comments on commit 876b88f

Please sign in to comment.