-
-
Notifications
You must be signed in to change notification settings - Fork 409
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
Changed to fstring #1706
Changed to fstring #1706
Conversation
Before a pull request is accepted, it must meet the following criteria:
|
Codecov Report
@@ Coverage Diff @@
## master #1706 +/- ##
==========================================
+ Coverage 61.06% 61.87% +0.81%
==========================================
Files 63 63
Lines 5820 5852 +32
==========================================
+ Hits 3554 3621 +67
+ Misses 2266 2231 -35
Continue to review full report at Codecov.
|
tardis/analysis.py
Outdated
self.current_no_packets, | ||
self.last_line_list_in.ix[event.ind], | ||
) | ||
f"Line_in ({len(event.ind)}/{self.current_no_packets}):\n{self.last_line_list_in.ix[event.ind]}" |
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.
please be PEP8 compliant
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.
Thank you @svenkat19, for the Pull Request. I have requested some changes else everything seems to be on the right track.
tardis/gui/widgets.py
Outdated
"wavelength" | ||
], | ||
) | ||
f"{key[0]}-{key[1]} {self.parent.model.atom_data.lines.ix[value[0]]["wavelength"]}" |
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.
The appended statement here has been changed. Please check that the statements adhere to their original intended meaning.
f"{key[0]}-{key[1]} {self.parent.model.atom_data.lines.ix[value[0]]["wavelength"]}" | |
f"{key[0]}-{key[1]} {self.parent.model.atom_data.lines.ix[value[0]]["wavelength"]:.2f} A" |
tardis/gui/widgets.py
Outdated
@@ -1225,7 +1214,7 @@ def on_species_clicked(self, index): | |||
last_line_in_model = self.createTable( | |||
[ | |||
last_line_in_string, | |||
["Num. pkts %d" % current_last_line_in.wavelength.count()], | |||
[f"Num. pkts {current_last_line_in.wavelength.count()}" ], |
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.
Extra space after the ending "
can be removed.
tardis/model/base.py
Outdated
"The following columns are specified in the csvy" | ||
"model file, but are IGNORED by TARDIS: %s" | ||
% (str(unsupported_columns)) | ||
f"The following columns are specified in the csvy model file, but are IGNORED by TARDIS: {str(unsupported_columns)}" |
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.
Please adhere to the Black
formatting styling. This seems to be off here in terms of the formatting of the message under the logger.warning
Could you please go through and let me know if I must change anything else? Cheers :) |
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.
Please check these comments. Otherwise, it looks Good to me 🚀.
tardis/analysis.py
Outdated
@@ -262,7 +254,7 @@ def load_t_inner(self, iterations=None): | |||
|
|||
for iter in iterations: | |||
t_inners.append( | |||
hdf_store["model%03d/configuration" % iter].ix["t_inner"] | |||
hdf_store[f"model{iter:003d}/configuration"].ix["t_inner"] |
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.
Why has there been a change in the string formatting? What I mean is why is it 003d
instead of 03d
?
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.
Why has there been a change in the string formatting? What I mean is why is it
003d
instead of03d
?
This has got to be the silliest error done by me😅. Do let me know if there are any mistakes I must fix. Cheers !!
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.
Sure, Everything else seems to be Awesome. These things can be overlooked easily that's why I raised it here. Thank you for making the required changes 😄
tardis/analysis.py
Outdated
@@ -281,8 +273,8 @@ def load_t_rads(self, iterations=None): | |||
iterations = self.iterations[iterations] | |||
|
|||
for iter in iterations: | |||
current_iter = "iter%03d" % iter | |||
t_rads_dict[current_iter] = hdf_store["model%03d/t_rads" % iter] | |||
current_iter = f"iter{iter:003d}" |
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.
Check the previous comment.
tardis/analysis.py
Outdated
@@ -319,7 +311,7 @@ def load_level_populations(self, iterations=None): | |||
iterations = self.iterations[iterations] | |||
|
|||
for iter in iterations: | |||
current_iter = "iter%03d" % iter | |||
current_iter = f"iter{iter:003d}" |
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.
Same here 🤔
tardis/analysis.py
Outdated
@@ -381,7 +373,7 @@ def load_spectrum(self, iteration, spectrum_keyword="luminosity_density"): | |||
hdf_store = pd.HDFStore(self.hdf5_fname, "r") | |||
|
|||
spectrum = hdf_store[ | |||
"model%03d/%s" % (self.iterations[iteration], spectrum_keyword) | |||
f"model{self.iterations[iteration]:003d}/{spectrum_keyword}" |
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.
Same here
tardis/analysis.py
Outdated
@@ -426,7 +418,7 @@ def get_last_line_interaction(self, iteration=-1): | |||
self.load_atom_data() | |||
|
|||
hdf_store = pd.HDFStore(self.hdf5_fname, "r") | |||
model_string = "model" + ("%03d" % iteration) + "/%s" | |||
model_string = "model" + (f"{iteration:003d}" ) + "/%s" |
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.
Same here
Please do fix the tests that are failing. If you have any problems regarding the same, please do let us know 😄 |
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.
please fix the PEP8 violations
Description
<Changed strings to fstrings in python 3>
Motivation and context
How has this been tested?
Type of change
Checklist