Skip to content

Replace "foo!r" to "repr(foo)" syntax #29886

Closed
@ShaharNaveh

Description

@ShaharNaveh

Since we are moving to f-strings and dropping old strings formats (% and .format()), we no longer need to have the redundant %r and !r specifiers, instead we use the repr() format.

Notes:

  • Don't forget to link this issue in your PR, paste this https://github.com/pandas-dev/pandas/issues/29886 in your PR.

  • If any of your changed files are related to Replace old string formatting syntax with f-strings #29547 , please make sure to link your pull request to that issue as well, simply paste this https://github.com/pandas-dev/pandas/issues/29547 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'nt marked, please comment letting me know.


To check what files still needs to be fixed in the "pandas" directory:

grep -R -e '%r' -e '!r}' -e "'{}'" --include=*.{py,pyx} pandas/
Tip:

If you want to see the line number of the occurrence, replace the -l with -n
for example:

grep -n -R '%r' --include=*.{py,pyx} pandas/

The current list is:

  • ci/print_skipped.py

  • pandas/_config/config.py

  • pandas/conftest.py

  • pandas/core/accessor.py

  • pandas/core/algorithms.py

  • pandas/core/arrays/categorical.py

  • pandas/core/arrays/datetimelike.py

  • pandas/core/arrays/period.py

  • pandas/core/arrays/numpy_.py

  • pandas/core/computation/align.py

  • pandas/core/computation/eval.py

  • pandas/core/computation/expressions.py

  • pandas/core/computation/expr.py

  • pandas/core/computation/ops.py

  • pandas/core/computation/pytables.py

  • pandas/core/dtypes/common.py

  • pandas/core/dtypes/dtypes.py

  • pandas/core/frame.py

  • pandas/core/generic.py

  • pandas/core/groupby/grouper.py

  • pandas/core/indexes/base.py

  • pandas/core/indexes/datetimelike.py

  • pandas/core/indexes/interval.py

  • pandas/core/indexes/numeric.py

  • pandas/core/internals/concat.py

  • pandas/core/internals/managers.py

  • pandas/core/missing.py

  • pandas/core/nanops.py

  • pandas/core/reshape/concat.py

  • pandas/core/reshape/merge.py

  • pandas/core/reshape/tile.py

  • pandas/core/series.py

  • pandas/core/sorting.py

  • pandas/core/strings.py

  • pandas/core/window/rolling.py

  • pandas/__init__.py

  • pandas/io/formats/css.py

  • pandas/io/formats/excel.py

  • pandas/io/formats/style.py

  • pandas/io/html.py

  • pandas/io/parsers.py

  • pandas/_libs/interval.pyx

  • pandas/plotting/_core.py

  • pandas/tests/computation/test_eval.py

  • pandas/tests/frame/test_alter_axes.py

  • pandas/tests/frame/test_analytics.py

  • pandas/tests/frame/test_query_eval.py

  • pandas/tests/groupby/test_whitelist.py

  • pandas/tests/indexes/datetimes/test_datetime.py

  • pandas/tests/indexes/multi/test_integrity.py

  • pandas/tests/indexes/period/test_period.py

  • pandas/tests/indexes/test_common.py

  • pandas/tests/indexes/timedeltas/test_timedelta.py

  • pandas/tests/io/msgpack/test_case.py

  • pandas/tests/io/msgpack/test_extension.py

  • pandas/tests/io/parser/test_unsupported.py

  • pandas/tests/io/test_html.py

  • pandas/tests/test_expressions.py

  • pandas/tests/test_strings.py

  • pandas/tests/io/test_sql.py

  • pandas/tests/reshape/test_concat.py

  • pandas/tests/scalar/timedelta/test_timedelta.py

  • pandas/tests/series/test_missing.py

  • pandas/tests/tseries/offsets/test_fiscal.py

  • pandas/tests/tseries/offsets/test_offsets.py

  • pandas/tseries/offsets.py

  • pandas/util/_decorators.py

  • pandas/util/_test_decorators.py

  • pandas/util/testing.py

  • pandas/_version.py

  • /scripts/tests/test_validate_docstrings.py


Lastly:

  • Add a test case (so we won't regress)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions