Skip to content
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

improved the string formatting syntax #4287

Closed
wants to merge 0 commits into from

Conversation

sayantan1410
Copy link
Contributor

@sayantan1410 sayantan1410 commented May 14, 2021

I have changed the format of the strings in the print statement from old percentage version to the new format.

Contributes to #4136

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

@sayantan1410 Thanks for your contribution!
Please update this line as well

raise Exception('Cannot find lightgbm library file in following paths:\n' + '\n'.join(dll_path))

in a similar manner ('\n' cannot be used inside f-strings)
aliases_joined = '``, ``'.join([x.strip() for x in aliases[0].split(',')])
aliases_str = f', aliases: ``{aliases_joined}``'

tests/c_api_test/test_.py Outdated Show resolved Hide resolved
@jameslamb
Copy link
Collaborator

Thanks for the help @sayantan1410 ! Please note I've added the following to the description of this pull request:

Contributes to #4136

Mentioning any prior discussions about a change helps us, as reviewers, to more quickly understand what your pull request is trying to accomplish. It also helps us to trace back through the project's history and find related discussions.

@sayantan1410
Copy link
Contributor Author

Okay thank you so much. @jameslamb

@jameslamb
Copy link
Collaborator

Sorry for the inconvenience, but we recently merged a fix for some CI issues (#4288 ). Whenever you have time, could you please update this branch to the latest master? That should fix the failing builds.

@sayantan1410
Copy link
Contributor Author

I will surely do that, there is absolutely no problem @jameslamb

@sayantan1410
Copy link
Contributor Author

Hey, I have updated my branch with the master branch. Let me know if I have done everything correctly or something is needed to be changed or updated. @jameslamb

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

@sayantan1410 Thanks for adding line 32 into this PR. Please take a look at my new comments below.

Also, looks like there was a merging conflict - this PR shouldn't contain any files other than tests/c_api_test/test_.py. Could you please fix this conflict?

Comment on lines 32 to 33
dll_path_joined = '\n\n'.join(dll_path)
raise Exception(f'Cannot find lightgbm library file in following paths: {dll_path_joined}')
Copy link
Collaborator

Choose a reason for hiding this comment

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

The first \n was to separate the first sentence from the list of paths and items inside the list were combined with only one \n not two.

Suggested change
dll_path_joined = '\n\n'.join(dll_path)
raise Exception(f'Cannot find lightgbm library file in following paths: {dll_path_joined}')
dll_path_joined = '\n'.join(dll_path)
raise Exception(f'Cannot find lightgbm library file in following paths:\n{dll_path_joined}')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay i will update the '/n' part and should I take back the commits that committed other files and make a fresh commit ? probably that is the way to do it. @StrikerRUS

@@ -234,7 +235,7 @@ def test_booster():
ctypes.byref(out_len),
result.ctypes.data_as(ctypes.POINTER(ctypes.c_double)))
if i % 10 == 0:
print('%d iteration test AUC %f' % (i, result[0]))
print(f'{i} interation test AUC {result[0]:.6f}')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
print(f'{i} interation test AUC {result[0]:.6f}')
print(f'{i} iteration test AUC {result[0]:.6f}')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am so ashamed of this kind of errors, really sorry, will surely fix it. @StrikerRUS

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, please don't be ashamed! We appreciate your help!

@sayantan1410
Copy link
Contributor Author

Hey, Because of some issue there was lots of errors in the check that's why I deleted all the commits but that for some reason closed the pull request, I didn't know that this happens, I am really sorry, Can I open a new pull request, I have everything figured out for the issue. Sorry for the inconvenience, I am ashamed I did this but it will be great if I solve the issue from another pull request. Actually I am new to open source contribution that is why I messed it up. @jameslamb

@jameslamb
Copy link
Collaborator

Yes, please open a new pull request and we'd be happy to review it. No worries! @ me if you need any help.

@sayantan1410
Copy link
Contributor Author

Thank you so much !!!

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants