Skip to content

Allow grouping char (,_) in decimal format string#221

Merged
wimglenn merged 6 commits intor1chardj0n3s:masterfrom
moi90:int-seperator
Feb 5, 2026
Merged

Allow grouping char (,_) in decimal format string#221
wimglenn merged 6 commits intor1chardj0n3s:masterfrom
moi90:int-seperator

Conversation

@moi90
Copy link
Copy Markdown
Contributor

@moi90 moi90 commented Feb 4, 2026

Closes #220.

width = "+"
s = r"\d{w}|[-+ ]?0[xX][0-9a-fA-F]{w}|[-+ ]?0[bB][01]{w}|[-+ ]?0[oO][0-7]{w}".format(
w=width
s = r"[-+ ]?[0-9{g}]{w}|[-+ ]?0[xX][0-9a-fA-F{g}]{w}|[-+ ]?0[bB][01{g}]{w}|[-+ ]?0[oO][0-7{g}]{w}".format(
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.

I added a [-+ ]? for the base10 part because it seemed missing. I don't know if that is necessary.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 4, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.73%. Comparing base (5bfb45d) to head (8de388b).
⚠️ Report is 3 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #221      +/-   ##
==========================================
+ Coverage   94.67%   94.73%   +0.05%     
==========================================
  Files           1        1              
  Lines         545      551       +6     
  Branches      128      130       +2     
==========================================
+ Hits          516      522       +6     
  Misses         19       19              
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@moi90
Copy link
Copy Markdown
Contributor Author

moi90 commented Feb 5, 2026

Thanks for your quick review and your additions! Is there anything more that I can do?

@wimglenn
Copy link
Copy Markdown
Collaborator

wimglenn commented Feb 5, 2026

Seems fine in current form. It's a bit strange that this will still parse the underscore separators in Python 2.7 even though underscore separators were not added for str.format until Py 3.6, but I couldn't imagine how that would actually backwards break anything.

@wimglenn wimglenn merged commit 35b9ffb into r1chardj0n3s:master Feb 5, 2026
23 checks passed
@moi90 moi90 deleted the int-seperator branch February 5, 2026 21:41
@moi90
Copy link
Copy Markdown
Contributor Author

moi90 commented Feb 5, 2026

Thanks for merging!

It's a bit strange that this will still parse the underscore separators in Python 2.7 even though underscore separators were not added for str.format until Py 3.6, but I couldn't imagine how that would actually backwards break anything.

I would assume that it's fine. And, as a user I would be surprised if underscore parsing was explicitly excluded for 2.7 while it is possible with later versions of the package.

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.

ValueError: format spec ',d' not recognised

3 participants