Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Python string formatting #21136

Merged
merged 12 commits into from
Sep 16, 2022
Merged

Conversation

hankaj
Copy link
Contributor

@hankaj hankaj commented Sep 6, 2022

This PR changes most of the %-formatting in python to f-strings (or format() in some cases).
According to Python documentation f-strings and format() are preferred to the %-formatting (which was used in Python 2).

@mxnet-bot
Copy link

Hey @hankaj , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [clang, miscellaneous, windows-gpu, edge, unix-cpu, centos-gpu, centos-cpu, website, windows-cpu, unix-gpu, sanity]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 6, 2022
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 7, 2022
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 7, 2022
@hankaj
Copy link
Contributor Author

hankaj commented Sep 8, 2022

@mxnet-bot run ci [unix-gpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-gpu]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-work-in-progress PR is still work in progress labels Sep 8, 2022
@mseth10 mseth10 added pr-awaiting-review PR is waiting for code review and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 9, 2022
benchmark/python/sparse/dot.py Outdated Show resolved Hide resolved
'Please train the models and run inference again' % bucket_name)
raise Exception("No trained models found in S3 bucket : %s for this file. "
"Please train the models and run inference again" % bucket_name)
logging.error('No trained models found in S3 bucket : {} for this file. '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to have to different approaches than in line 110?
here {bucket_name} seems to be more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In CI I got the error that you should not use f-strings in messages of logging functions.

Comment on lines 124 to 127
logging.error('No trained models found in S3 bucket : {} for this file. '
'Please train the models and run inference again'.format(bucket_name))
raise Exception(f"No trained models found in S3 bucket : {bucket_name} for this file. "
"Please train the models and run inference again")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Suggested change
logging.error('No trained models found in S3 bucket : {} for this file. '
'Please train the models and run inference again'.format(bucket_name))
raise Exception(f"No trained models found in S3 bucket : {bucket_name} for this file. "
"Please train the models and run inference again")
logging.error(f'No trained models found in S3 bucket : {bucket_name} for this file. '
'Please train the models and run inference again')
raise Exception(f"No trained models found in S3 bucket : {bucket_name} for this file. "
"Please train the models and run inference again")

tests/python/unittest/test_profiler.py Show resolved Hide resolved
tests/python/unittest/test_profiler.py Show resolved Hide resolved
tests/python/unittest/test_profiler.py Show resolved Hide resolved
python/mxnet/gluon/contrib/estimator/estimator.py Outdated Show resolved Hide resolved
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-awaiting-review PR is waiting for code review pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 13, 2022
@bgawrych
Copy link
Contributor

@mxnet-bot run ci [sanity]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [sanity]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-work-in-progress PR is still work in progress labels Sep 13, 2022
Copy link
Contributor

@bgawrych bgawrych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed 2x - LGTM

@bgawrych
Copy link
Contributor

@mxnet-bot run ci [all]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [sanity, centos-cpu, windows-cpu, miscellaneous, windows-gpu, unix-cpu, clang, unix-gpu, centos-gpu, website, edge]

@mseth10 mseth10 added pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 13, 2022
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 13, 2022
@hankaj
Copy link
Contributor Author

hankaj commented Sep 14, 2022

@mxnet-bot run ci [unix-gpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-gpu]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Sep 14, 2022
@bgawrych bgawrych merged commit c8922fe into apache:master Sep 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants