-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Replace old string formatting syntax with f-strings #29547
Comments
Im taking:
|
I'll take:
to start, if that's alright! |
Hi @MomIsBestFriend Can you recommend any tools for this conversion? A quick look gave me these: I have no experience with either of them, but they could be very helpful here |
Hello @SaturnFromTitan , I personally sometimes use pyupgrade but only when the file contain only a few outdated string formats in it. Then I look at the changes and fix if pyupgrade got something wrong. When they're files with alot of occurrences I go for the "complex" ones manually (e.g Also, some of the changes will make the changed file non pep8 compatible, so there's a need to fix that as well, otherwise it will not pass the tests. |
Will take next:
|
I'll take:
What are everyone's thoughts on tagging this as a I'm picturing a setup similar to #28926. |
f-string replacement placed on:
ref #29701 |
Will take next:
|
I'll take
ref #29781 |
Sure ive labelled accordingly. thanks |
… 2 files were fixed
The two files were modified: Note that there was no issues in the following ones. You can mark as done too: note: this is my first PR ever. Let me know if something need to be improved. |
I've went through the topic to update the list + check some files. Files marked as done without any commit(no need to change anything):
Remaining files to check:
|
I took care of
|
Hi Matteo,
I'm interested in helping with this effort, but am new to git and
contributing to pandas. Would you possibly be able to walk me through the
steps ? Perhaps I can setup a screen share this week?
Thanks,
Andrew
…On Tue, May 26, 2020, 3:12 PM Matteo Santamaria ***@***.***> wrote:
I took care of pandas/util/_validators.py. Many of these other files
already seem ok to me too.
- pandas/util/_test_decorators.py
- pandas/tseries/frequencies.py
- pandas/tests/util/test_assert_frame_equal.py
- pandas/tests/tslibs/test_parsing.py
- pandas/tests/tseries/holiday/test_holiday.py
- pandas/tests/tseries/holiday/test_calendar.py
- pandas/tests/tools/test_to_datetime.py
- pandas/tests/test_strings.py
- pandas/tests/series/test_repr.py
- pandas/tests/series/test_datetime_values.py
- pandas/tests/series/test_constructors.py
- pandas/tests/series/test_api.py
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#29547 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APG73XKAUDLFVVQXUS2SJETRTQ5DDANCNFSM4JLZCU5Q>
.
|
Hey @warden706, I'm actually pretty new here too, so I wouldn't have much to show you. I've found this resource very helpful as I've stumbled around, you should check it out. |
Hi,
I checked these other files and seem ok to me
|
i'm also new here.
i have a question regarding the code change.
so my suggestion is to replace it to:
is that good enough? |
Hi, |
Master should generally pass the tests. Make sure you've pulled the latest commits. Which tests are failing? |
@matteosantama I pulled last commits, re-installed the environment an re-run the tests with
I noticed that if I run tests only on the single directory (for example with
|
Since the @OlivierLuG comment, it seems like almost all of the files have been corrected or were already ok without any modification. I'll try to update the list about the "still open" files. Corrected
No need to modification
Moreover, I think that also this is already ok
Still to check/correct
@DanBasson do you have any update? |
i keep getting errors which i don't know what they mean. |
Have you tried to fetch the latest modifications on master? Maybe it will fix some of the failed tests. |
it didn't help. |
I have a doubt: when we have a situation like in
and so on, should we transform |
@MatteoFelici thanks for that updated list. I checked the last few remaining modules you called out and this looks OK, so I think we can close this issue |
Since we no longer support python 3.5, we can now use the new f-strings instead of the old
.format()
( and obviously the%
formatting).Notes:
Don't forget to link this issue in your pull request's body message , simply paste this
https://github.com/pandas-dev/pandas/issues/29547
in your pull request's body message.If any of your changed files are related to Replace "foo!r" to "repr(foo)" syntax #29886 , please make sure to link your pull request to that issue as well, simply paste this
https://github.com/pandas-dev/pandas/issues/29886
in your pull request's body message as well.Please comment what you are planning to work on, so we won't do double work.
If a file/files that should be marked as done, is not marked, please comment letting me know.
To check what files still needs to be fixed in the
pandas
directory:All of the above can also be used as a one liner:
Tip:
If you want to see the line number of the occurrence, replace the
-l
with-n
for example:
The current list is:
pandas/compat/pickle_compat.py
pandas/_config/config.py
pandas/core/arrays/datetimelike.py
pandas/core/arrays/datetimes.py
pandas/core/arrays/integer.py
pandas/core/arrays/period.py
pandas/core/computation/pytables.py
pandas/core/config_init.py
pandas/core/frame.py
pandas/core/generic.py
pandas/core/groupby/generic.py
pandas/core/groupby/groupby.py
pandas/core/indexes/base.py
pandas/core/indexes/multi.py
pandas/core/indexes/range.py
pandas/core/ops/docstrings.py
pandas/core/ops/__init__.py
pandas/core/reshape/merge.py
pandas/core/tools/datetimes.py
pandas/io/formats/css.py
pandas/io/formats/excel.py
pandas/io/formats/format.py
pandas/io/formats/html.py
pandas/io/formats/info.py
pandas/io/formats/latex.py
pandas/io/formats/printing.py
pandas/io/formats/style.py
pandas/io/parsers.py
pandas/io/pytables.py
pandas/io/sas/sas_xport.py
pandas/io/stata.py
pandas/_libs/tslibs/c_timestamp.pyx
pandas/_libs/tslibs/frequencies.pyx
pandas/_libs/tslibs/parsing.pyx
pandas/_libs/tslibs/period.pyx
pandas/_libs/tslibs/strptime.pyx
pandas/_libs/tslibs/timedeltas.pyx
pandas/plotting/_matplotlib/converter.py
pandas/tests/arrays/categorical/test_operators.py
pandas/tests/arrays/test_datetimelike.py
pandas/tests/dtypes/test_dtypes.py
pandas/tests/extension/base/setitem.py
pandas/tests/frame/test_constructors.py
pandas/tests/frame/test_missing.py
pandas/tests/frame/test_to_csv.py
pandas/tests/groupby/aggregate/test_other.py
pandas/tests/indexes/datetimes/test_date_range.py
pandas/tests/indexes/datetimes/test_datetime.py
pandas/tests/indexes/datetimes/test_formats.py
pandas/tests/indexes/datetimes/test_partial_slicing.py
pandas/tests/indexes/interval/test_constructors.py
pandas/tests/indexes/interval/test_interval.py
pandas/tests/indexes/multi/test_format.py
pandas/tests/indexes/period/test_formats.py
pandas/tests/indexes/test_base.py
pandas/tests/indexes/timedeltas/test_timedelta.py
pandas/tests/indexing/test_categorical.py
pandas/tests/indexing/test_coercion.py
pandas/tests/io/excel/test_openpyxl.py
pandas/tests/io/excel/test_writers.py
pandas/tests/io/formats/test_format.py
pandas/tests/io/formats/test_printing.py
pandas/tests/io/formats/test_style.py
pandas/tests/io/formats/test_to_csv.py
pandas/tests/io/formats/test_to_html.py
pandas/tests/io/formats/test_to_latex.py
pandas/tests/io/parser/test_compression.py
pandas/tests/io/parser/test_encoding.py
pandas/tests/io/parser/test_header.py
pandas/tests/io/parser/test_parse_dates.py
pandas/tests/io/parser/test_usecols.py
pandas/tests/io/test_html.py
pandas/tests/io/test_sql.py
pandas/tests/io/test_stata.py
pandas/tests/reductions/test_reductions.py
pandas/tests/reshape/test_concat.py
pandas/tests/reshape/test_melt.py
pandas/tests/scalar/period/test_period.py
pandas/tests/scalar/timedelta/test_timedelta.py
pandas/tests/scalar/timestamp/test_constructors.py
pandas/tests/series/indexing/test_numeric.py
pandas/tests/series/indexing/test_take.py
pandas/tests/series/indexing/test_where.py
pandas/tests/series/methods/test_rename.py
pandas/tests/series/test_api.py
pandas/tests/series/test_constructors.py
pandas/tests/series/test_datetime_values.py
pandas/tests/series/test_repr.py
pandas/tests/test_strings.py
pandas/tests/tools/test_to_datetime.py
pandas/tests/tseries/holiday/test_calendar.py
pandas/tests/tseries/holiday/test_holiday.py
pandas/tests/tslibs/test_parsing.py
pandas/tests/util/test_assert_frame_equal.py
pandas/tseries/frequencies.py
pandas/util/_decorators.py
pandas/util/_test_decorators.py
pandas/util/_validators.py
pandas/_version.py
NOTE:
The list may change as files are moved/renamed constantly.
Inhereted files and commands from this PR.
The text was updated successfully, but these errors were encountered: