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

Add stubs for zstd #9484

Merged
merged 5 commits into from
Feb 1, 2023
Merged

Add stubs for zstd #9484

merged 5 commits into from
Feb 1, 2023

Conversation

victorbnl
Copy link
Contributor

@victorbnl victorbnl commented Jan 9, 2023

Based on zstd's documentation

Closes #9483

@@ -0,0 +1,13 @@
class Error(Exception): ...

def ZSTD_compress(data: str | bytes, level: int | None, threads: int | None) -> str | bytes: ...
Copy link
Member

Choose a reason for hiding this comment

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

If I remember my C argument codes correctly, the first arg should be _typeshed.ReadableBuffer (https://github.com/sergey-dryabzhinsky/python-zstd/blob/master/src/python-zstd.c#L68 - I think y# is buffers). Also, the return type appears to be always bytes.

(We don't care about Python 2 in typeshed.)

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 just tested and you seem to be right, I change it

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! I haven't looked at the other functions but I suspect the same things apply elsewhere. A few functions appear to be aliases for this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep there are a lot of aliases, namely

  • ZSTD_compress
    • compress
    • dumps
  • ZSTD_uncompress
    • decompress
    • uncompress
    • loads
  • ZSTD_version
    • version

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

stubs/zstd/zstd.pyi Outdated Show resolved Hide resolved
stubs/zstd/zstd.pyi Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 1cc8080 into python:main Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stubs for zstd
2 participants