-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor warning/error parsing #800
Changes from all commits
d0fe0a7
04c336d
0578c21
a32dfcc
d2014d5
8ae2b43
4102204
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,30 +372,34 @@ | |
|
||
exp_errors_warnings = { | ||
'errors': { | ||
'2017': { | ||
'FICA_ss_trt': 'ERROR: _FICA_ss_trt value -1.0 < min value 0 for 2017', | ||
'II_brk4_0': 'ERROR: _II_brk4_0 value 500.0 < min value 91900.0 for _II_brk3_0 for 2017'}, | ||
'2018': { | ||
'FICA_ss_trt': 'ERROR: _FICA_ss_trt value -1.0 < min value 0 for 2018', | ||
'II_brk4_0': 'ERROR: _II_brk4_0 value 511.25 < min value 93967.75 for _II_brk3_0 for 2018'}, | ||
'2019': {'II_brk4_0': 'ERROR: _II_brk4_0 value 522.7 < min value 96072.63 for _II_brk3_0 for 2019'}, | ||
'2020': {'II_brk4_0': 'ERROR: _II_brk4_0 value 534.77 < min value 98291.91 for _II_brk3_0 for 2020'}, | ||
'2021': {'II_brk4_0': 'ERROR: _II_brk4_0 value 547.5 < min value 100631.26 for _II_brk3_0 for 2021'}, | ||
'2022': {'II_brk4_0': 'ERROR: _II_brk4_0 value 560.8 < min value 103076.6 for _II_brk3_0 for 2022'}, | ||
'2023': {'II_brk4_0': 'ERROR: _II_brk4_0 value 574.09 < min value 105519.52 for _II_brk3_0 for 2023'}, | ||
'2024': {'II_brk4_0': 'ERROR: _II_brk4_0 value 587.87 < min value 108051.99 for _II_brk3_0 for 2024'}, | ||
'2025': {'II_brk4_0': 'ERROR: _II_brk4_0 value 601.86 < min value 110623.63 for _II_brk3_0 for 2025'}, | ||
'2026': {'II_brk4_0': 'ERROR: _II_brk4_0 value 616.18 < min value 113256.47 for _II_brk3_0 for 2026'}, | ||
'2027': {'II_brk4_0': 'ERROR: _II_brk4_0 value 630.97 < min value 115974.63 for _II_brk3_0 for 2027'} | ||
'FICA_ss_trt': { | ||
'2017': 'ERROR: _FICA_ss_trt value -1.0 < min value 0 for 2017', | ||
'2018': 'ERROR: _FICA_ss_trt value -1.0 < min value 0 for 2018' | ||
}, | ||
'II_brk4_0': { | ||
'2017': 'ERROR: _II_brk4_0 value 500.0 < min value 91900.0 for _II_brk3_0 for 2017', | ||
'2018': 'ERROR: _II_brk4_0 value 511.25 < min value 93967.75 for _II_brk3_0 for 2018', | ||
'2019': 'ERROR: _II_brk4_0 value 522.7 < min value 96072.63 for _II_brk3_0 for 2019', | ||
'2020': 'ERROR: _II_brk4_0 value 534.77 < min value 98291.91 for _II_brk3_0 for 2020', | ||
'2021': 'ERROR: _II_brk4_0 value 547.5 < min value 100631.26 for _II_brk3_0 for 2021', | ||
'2022': 'ERROR: _II_brk4_0 value 560.8 < min value 103076.6 for _II_brk3_0 for 2022', | ||
'2023': 'ERROR: _II_brk4_0 value 574.09 < min value 105519.52 for _II_brk3_0 for 2023', | ||
'2024': 'ERROR: _II_brk4_0 value 587.87 < min value 108051.99 for _II_brk3_0 for 2024', | ||
'2025': 'ERROR: _II_brk4_0 value 601.86 < min value 110623.63 for _II_brk3_0 for 2025', | ||
'2026': 'ERROR: _II_brk4_0 value 616.18 < min value 113256.47 for _II_brk3_0 for 2026', | ||
'2027': 'ERROR: _II_brk4_0 value 630.97 < min value 115974.63 for _II_brk3_0 for 2027' | ||
} | ||
}, | ||
'warnings': { | ||
'2020': {'STD_3': 'WARNING: _STD_3 value 150.0 < min value 9900.32 for 2020'}, | ||
'2021': {'STD_3': 'WARNING: _STD_3 value 153.57 < min value 10138.33 for 2021'}, | ||
'2022': {'STD_3': 'WARNING: _STD_3 value 157.3 < min value 10387.12 for 2022'}, | ||
'2023': {'STD_3': 'WARNING: _STD_3 value 161.03 < min value 10635.66 for 2023'}, | ||
'2024': {'STD_3': 'WARNING: _STD_3 value 164.89 < min value 10893.32 for 2024'}, | ||
'2025': {'STD_3': 'WARNING: _STD_3 value 168.81 < min value 11154.96 for 2025'}, | ||
'2026': {'STD_3': 'WARNING: _STD_3 value 172.83 < min value 11422.83 for 2026'}, | ||
'2027': {'STD_3': 'WARNING: _STD_3 value 176.98 < min value 11699.38 for 2027'} | ||
'STD_3': { | ||
'2020': 'WARNING: _STD_3 value 150.0 < min value 9900.32 for 2020', | ||
'2021': 'WARNING: _STD_3 value 153.57 < min value 10138.33 for 2021', | ||
'2022': 'WARNING: _STD_3 value 157.3 < min value 10387.12 for 2022', | ||
'2023': 'WARNING: _STD_3 value 161.03 < min value 10635.66 for 2023', | ||
'2024': 'WARNING: _STD_3 value 164.89 < min value 10893.32 for 2024', | ||
'2025': 'WARNING: _STD_3 value 168.81 < min value 11154.96 for 2025', | ||
'2026': 'WARNING: _STD_3 value 172.83 < min value 11422.83 for 2026', | ||
'2027': 'WARNING: _STD_3 value 176.98 < min value 11699.38 for 2027' | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One software engineering practice you might want to consider is separating "code" from "data". In this case the "data" is these warnings, which could be saved as like a separate JSON file somewhere and loaded into Python (using the default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see. I'll open a follow up PR to clean up |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a
defaultdict
here instead, i.e.Then you can get rid of the
year not in
check. This is a common build pattern which is whydefaultdict
was added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice.
defaultdict
is pretty nifty. I wish I'd known aboutdefaultdict
earlier.