Skip to content

Commit

Permalink
Fixed fstring issue from mixing quotes and reformatted files from fst…
Browse files Browse the repository at this point in the history
…ring PR with black (tardis-sn#1842)

* Fixed fstring issue from mixing quotes

* Fixed formatting with black

* updated with newer black version
  • Loading branch information
Rodot- authored and DhruvSondhi committed Dec 14, 2021
1 parent 0cbdf74 commit 485848a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions tardis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ def plot_wave_in_out(self, fig, do_clf=True, plot_resonance=True):
def onpick(event):
print("-" * 80)
print(
"Line_in"
f"({len(event.ind)}/{self.current_no_packets})"\
f":\n{self.last_line_list_in.ix[event.ind]}"
"Line_in"
f"({len(event.ind)}/{self.current_no_packets})"
f":\n{self.last_line_list_in.ix[event.ind]}"
)
print("\n\n")
print(
"Line_out"
"Line_out"
f"({len(event.ind)}/{self.current_no_packets})"
f":\n{self.last_line_list_in.ix[event.ind]}"
)
Expand Down Expand Up @@ -275,7 +275,7 @@ def load_t_rads(self, iterations=None):
iterations = self.iterations[iterations]

for iter in iterations:
current_iter = f"iter{iter:03d}"
current_iter = f"iter{iter:03d}"
t_rads_dict[current_iter] = hdf_store[f"model{iter:03d}/t_rads"]

t_rads = pd.DataFrame(t_rads_dict)
Expand Down Expand Up @@ -313,7 +313,7 @@ def load_level_populations(self, iterations=None):
iterations = self.iterations[iterations]

for iter in iterations:
current_iter = f"iter{iter:03d}"
current_iter = f"iter{iter:03d}"
level_populations_dict[current_iter] = hdf_store[
f"model{iter:03d}/level_populations"
]
Expand Down Expand Up @@ -420,7 +420,7 @@ def get_last_line_interaction(self, iteration=-1):
self.load_atom_data()

hdf_store = pd.HDFStore(self.hdf5_fname, "r")
model_string = "model" + (f"{iteration:03d}" ) + "/%s"
model_string = "model" + (f"{iteration:03d}") + "/%s"
last_line_interaction_in_id = hdf_store[
model_string % "last_line_interaction_in_id"
].values
Expand Down
10 changes: 5 additions & 5 deletions tardis/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def __init__(self, index, tablecreator, parent=None):
self.parent = parent
self.shell_index = index
self.setGeometry(400, 150, 200, 400)
self.setWindowTitle(f"Shell {self.shell_index + 1} Abundances" )
self.setWindowTitle(f"Shell {self.shell_index + 1} Abundances")
self.atomstable = QtWidgets.QTableView()
self.ionstable = QtWidgets.QTableView()
self.levelstable = QtWidgets.QTableView()
Expand All @@ -829,7 +829,7 @@ def __init__(self, index, tablecreator, parent=None):

self.table1_data = self.parent.model.plasma.abundance[self.shell_index]
self.atomsdata = self.createTable(
[["Z = "], [f"Count (Shell {self.shell_index + 1})" ]],
[["Z = "], [f"Count (Shell {self.shell_index + 1})"]],
iterate_header=(2, 0),
index_info=self.table1_data.index.values.tolist(),
)
Expand Down Expand Up @@ -889,7 +889,7 @@ def on_ion_header_double_clicked(self, index):
self.shell_index
].ix[self.current_atom_index, self.current_ion_index]
self.levelsdata = self.createTable(
[["Level: "], [f"Count (Ion {self.current_ion_index})" ]],
[["Level: "], [f"Count (Ion {self.current_ion_index})"]],
iterate_header=(2, 0),
index_info=self.table3_data.index.values.tolist(),
)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def get_data(self, wavelength_start, wavelength_end):
/ self.grouped_lines_in.wavelength.count().sum()
).values.tolist()
for z, ion in self.ions_in:
self.header_list.append(f"Z = {z}: Ion {ion}" )
self.header_list.append(f"Z = {z}: Ion {ion}")

def get_transition_table(self, lines, atom, ion):
"""Called by the two methods below to get transition table for
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def get_transition_table(self, lines, atom, ion):
for key, value in transitions.items():
transitions_parsed.append(
f"{key[0]}-{key[1]}"
f"{self.parent.model.atom_data.lines.ix[value[0]]["wavelength"]:.2f} A"
f"{self.parent.model.atom_data.lines.ix[value[0]]['wavelength']:.2f} A"
)
return transitions_parsed, transitions_count

Expand Down
4 changes: 2 additions & 2 deletions tardis/io/parsers/csvy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def load_csvy(fname):
yaml_end_ind = i
break
else:
raise ValueError(f"End {YAML_DELIMITER} not found" )
raise ValueError(f"End {YAML_DELIMITER} not found")
yaml_dict = yaml.load("".join(yaml_lines[1:-1]), YAMLLoader)
try:
data = pd.read_csv(fname, skiprows=yaml_end_ind + 1)
Expand Down Expand Up @@ -71,7 +71,7 @@ def load_yaml_from_csvy(fname):
yaml_end_ind = i
break
else:
raise ValueError(f"End {YAML_DELIMITER} not found" )
raise ValueError(f"End {YAML_DELIMITER} not found")
yaml_dict = yaml.load("".join(yaml_lines[1:-1]), YAMLLoader)
return yaml_dict

Expand Down
2 changes: 1 addition & 1 deletion tardis/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def download_from_url(url, dst):
first_byte = 0
if first_byte >= file_size:
return file_size
header = {f"Range": "bytes={first_byte}-{file_size}" }
header = {f"Range": "bytes={first_byte}-{file_size}"}
pbar = tqdm(
total=file_size,
initial=first_byte,
Expand Down

0 comments on commit 485848a

Please sign in to comment.