Skip to content

Commit ec9126b

Browse files
committed
Correct usage of super() in inheritance tree
Don't recall why we were calling super() with the current class as an argument, but it isn't needed so lets clean up that type of usage. Correct tests after fixing typo in error Specify the type of the z -> symbol dictionary
1 parent 5a844d5 commit ec9126b

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

pynch/ame_mass_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AMEMassFile(Parse):
77

88
def __init__(self, year: int):
99
"""Setup up the values."""
10-
super(AMEMassFile, self).__init__()
10+
super().__init__()
1111
if year < 2020:
1212
self.HEADER = 39
1313
self.FOOTER = None

pynch/ame_reaction_1_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AMEReactionFileOne(Parse):
77

88
def __init__(self, year: int):
99
"""Setup the values that locate the variable."""
10-
super(AMEReactionFileOne, self).__init__()
10+
super().__init__()
1111
if year < 2020:
1212
self.HEADER = 39
1313
self.FOOTER = None

pynch/ame_reaction_2_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AMEReactionFileTwo(Parse):
77

88
def __init__(self, year: int):
99
"""Setup the values that locate the variables."""
10-
super(AMEReactionFileTwo, self).__init__()
10+
super().__init__()
1111
if year < 2020:
1212
self.HEADER = 39
1313
self.FOOTER = None

pynch/nubase_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class NubaseFile(Parse):
1313

1414
def __init__(self, year: int):
1515
"""Setup the values that locate the variable."""
16-
super(NubaseFile, self).__init__()
16+
super().__init__()
1717
if year < 2020:
1818
self.HEADER = 0
1919
self.FOOTER = None

pynch/parse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ def __init__(self):
1515
The _read functions could be taken out of the class, but then they wouldn't be inherited by the file parsers,
1616
so lets leave them as members for the moment.
1717
"""
18-
super(Parse, self).__init__()
19-
self.z_to_symbol = {
18+
self.z_to_symbol: dict[int, str] = {
2019
0: "n", 1: "H", 2: "He", 3: "Li", 4: "Be", 5: "B", 6: "C", 7: "N", 8: "O", 9: "F",
2120
10: "Ne", 11: "Na", 12: "Mg", 13: "Al", 14: "Si", 15: "P", 16: "S", 17: "Cl", 18: "Ar", 19: "K",
2221
20: "Ca", 21: "Sc", 22: "Ti", 23: "V", 24: "Cr", 25: "Mn", 26: "Fe", 27: "Co", 28: "Ni", 29: "Cu",

tests/test_ame_reaction_2_parse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_read_line():
2121
assert d['QProtonAlpha'] == 8181.34
2222
assert d['QProtonAlphaError'] == 1.16
2323
assert d['QNeutronAlpha'] == 7701.54
24-
assert d['QNeutronAlphaErrror'] == 3.34
24+
assert d['QNeutronAlphaError'] == 3.34
2525

2626
parser = AMEReactionParserTwo(pathlib.Path("."), 2012)
2727
line = " 204 Tl 81 6656.09 0.29 6365.80 1.25 -12470.19 22.31 13710.68 1.14 8181.16 1.15 7701.67 3.33"
@@ -41,7 +41,7 @@ def test_read_line():
4141
assert d['QProtonAlpha'] == 8181.16
4242
assert d['QProtonAlphaError'] == 1.15
4343
assert d['QNeutronAlpha'] == 7701.67
44-
assert d['QNeutronAlphaErrror'] == 3.33
44+
assert d['QNeutronAlphaError'] == 3.33
4545

4646
parser = AMEReactionParserTwo(pathlib.Path("."), 2016)
4747
line = " 204 Tl 81 6656.08 0.29 6365.85 1.25 -12470.71 22.32 13709.99 1.06 8180.45 1.07 7700.97 3.31"
@@ -61,7 +61,7 @@ def test_read_line():
6161
assert d['QProtonAlpha'] == 8180.45
6262
assert d['QProtonAlphaError'] == 1.07
6363
assert d['QNeutronAlpha'] == 7700.97
64-
assert d['QNeutronAlphaErrror'] == 3.31
64+
assert d['QNeutronAlphaError'] == 3.31
6565

6666

6767
parser = AMEReactionParserTwo(pathlib.Path("."), 2020)
@@ -82,4 +82,4 @@ def test_read_line():
8282
assert d['QProtonAlpha'] == 8180.5147
8383
assert d['QProtonAlphaError'] == 1.0721
8484
assert d['QNeutronAlpha'] == 7701.0380
85-
assert d['QNeutronAlphaErrror'] == 3.3084
85+
assert d['QNeutronAlphaError'] == 3.3084

0 commit comments

Comments
 (0)