-
Notifications
You must be signed in to change notification settings - Fork 614
strings: fix type hints and uncovered bugs #2555
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased)
section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed
860a8e3
to
349d368
Compare
CHANGELOG updated or no update needed, thanks! 😄
e5b59d7
to
4678af7
Compare
changelog add strings tests strings: fix buf_filled_with fix strings tests refactor: optimize and document buf_filled_with function in strings.py docs: add docstring to buf_filled_with function doc strings: add typing
4678af7
to
ead038a
Compare
Also do this for FLOSS? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the tests! LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvements, thanks. I have left some comments for your review.
these are all great ideas @fariss thank you! i'll add those in the morning and merge. thanks all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
ASCII_RE_4 = re.compile(b"([%s]{%d,})" % (ASCII_BYTE, 4)) | ||
UNICODE_RE_4 = re.compile(b"((?:[%s]\x00){%d,})" % (ASCII_BYTE, 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo 4
here is not very descriptive, I'd suggest declaring it a constant:
MIN_STRING_LENGTH = 4
ASCII_RE_4 = re.compile(b"([%s]{%d,})" % (ASCII_BYTE, MIN_STRING_LENGTH))
UNICODE_RE_4 = re.compile(b"((?:[%s]\x00){%d,})" % (ASCII_BYTE, MIN_STRING_LENGTH))
got the whole crew on this thread! 👋 |
When adding type hints (at the suggestion of my editor), I found that some of the strings.py helpers probably didn't ever work on python3. So I fixed those up and added some tests.
TODO