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

bpo-39323: Fix directory separator of imghdr cli output #17993

Closed
wants to merge 2 commits into from

Conversation

tirkarthi
Copy link
Member

@tirkarthi tirkarthi commented Jan 13, 2020

  • Use os.sep to indicate directory separator in imghdr cli output.
  • Add tests for imghdr cli.

https://bugs.python.org/issue39323

* Use os.sep to display path directories for better compatibility
* Add tests for imghdr cli
Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

LGTM for test code :) and I left a comment on Lib/imghdr.py

@@ -148,7 +148,7 @@ def testall(list, recursive, toplevel):
import os
for filename in list:
if os.path.isdir(filename):
print(filename + '/:', end=' ')
print(filename + os.sep +':', end=' ')
Copy link
Member

Choose a reason for hiding this comment

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

I don't know this kind of code churn is proper,
But if this is needed, what about this?

print(f'{filename}{os.sep}:', end=' ')

Copy link
Member Author

Choose a reason for hiding this comment

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

As a personal opinion, I don't see much improvement here in changing. It's just concatenating two separate variables and there are no other strings also as part of string like a + " equals " + b to f"{a} equals {b}" .

@hugovk
Copy link
Member

hugovk commented Apr 11, 2022

Note the imghdr modules is deprecated in 3.11 and set for removal in 3.13.

See PEP 594 – Removing dead batteries from the standard library and #91217.

@corona10 If you're happy to merge this, I suggest going ahead anyway, otherwise it could be closed. :)

@tirkarthi
Copy link
Member Author

Thanks @hugovk , I am okay with closing this.

@tirkarthi tirkarthi closed this Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants