Skip to content

Add ppm file to extensions#352

Merged
asottile merged 1 commit intopre-commit:mainfrom
andrewring:patch-1
Dec 15, 2022
Merged

Add ppm file to extensions#352
asottile merged 1 commit intopre-commit:mainfrom
andrewring:patch-1

Conversation

@andrewring
Copy link
Copy Markdown
Contributor

PPM is portable pixmap format

Comment thread identify/extensions.py Outdated
'png': {'binary', 'image', 'png'},
'po': {'text', 'pofile'},
'pp': {'text', 'puppet'},
'ppm': {'binary', 'image', 'ppm'},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the point of ppm is it's not binary https://anthonysottile.com/ppm/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As I look more, it's actually conditional. The magic number at the beginning of the file indicates if it should be parsed as ASCII or binary, so I guess we can't really make this kind of assertion based on extension alone, unfortunately. Is there somewhere in the existing flow that this type of check would be supported? The linux file utility, for example, can correctly identify a binary example, like this:

frame-40.ppm: Netpbm image data, size = 1920 x 1080, rawbits, pixmap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

EXTENSIONS_NEED_BINARY_CHECK = {
it is then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated. Please let me know if there's somewhere else that also needs updating.

@andrewring andrewring requested a review from asottile December 15, 2022 02:19
PPM is portable pixmap format
Copy link
Copy Markdown
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit e834194 into pre-commit:main Dec 15, 2022
@andrewring andrewring deleted the patch-1 branch August 21, 2023 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants