8000 Add `-i/--issue` and `-s/--section` flags to `blurb add` by picnixz · Pull Request #16 · python/blurb · GitHub
[go: up one dir, main page]

Skip to content

Add -i/--issue and -s/--section flags to blurb add #16

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d5d11a2
Improve `blurb add` command.
picnixz Jun 25, 2024
eaddee3
update version
picnixz Jun 25, 2024
403d387
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 25, 2024
ad230fe
fix CI/CD
picnixz Jun 25, 2024
edd8eea
Merge branch 'add-gh-flags' of github.com:picnixz/blurb into add-gh-f…
picnixz Jun 25, 2024
9856548
fixup! typos
picnixz Jun 26, 2024
a2a1fce
add test for known section names
picnixz Jun 26, 2024
7d67830
expand tests
picnixz Jun 26, 2024
635c8ac
improve section name detection
picnixz Jun 26, 2024
992b8ec
improve tests
picnixz Jun 26, 2024
842bc2d
address review!
picnixz Jun 26, 2024
99261a5
remove extraneous line
picnixz Jun 26, 2024
114013c
Merge branch 'main' into add-gh-flags
picnixz Jul 12, 2024
18a5563
address Larry's comments
picnixz Jul 13, 2024
350daeb
remove local fix
picnixz Jul 13, 2024
0e25cc0
remove un-necessary blank line
picnixz Jul 13, 2024
2b976e2
...
picnixz Jul 13, 2024
d578f92
use the same example in the README and the docstring of `add`
picnixz Jul 13, 2024
f11b9f1
Update README.md
picnixz Jul 13, 2024
6737ea4
Update README.md
picnixz Jul 13, 2024
384079d
Update src/blurb/blurb.py
picnixz Jul 13, 2024
9242ddc
Update src/blurb/blurb.py
hugovk Jul 13, 2024
8619bc2
Update README.md
picnixz Jul 13, 2024
9de55af
improve matching algorithm
picnixz Jul 13, 2024
a7cd263
increase test coverage
picnixz Jul 13, 2024
ba33c38
update comments
picnixz Jul 13, 2024
cb04947
simplify supported separators
picnixz Jul 13, 2024
33ae76e
fix regex
picnixz Jul 13, 2024
48fc24b
improve error messages
picnixz Jul 13, 2024
15271e1
cleanup
picnixz Jul 13, 2024
a3899ec
Merge branch 'main' into add-gh-flags
picnixz Aug 14, 2024
026052c
Update README.md
picnixz Aug 14, 2024
5fe40bd
Update CHANGELOG.md
picnixz Aug 14, 2024
1f789b0
Merge branch 'main' into add-gh-flags
picnixz Nov 1, 2024
792c0a6
Merge branch 'main' into add-gh-flags
picnixz Jun 1, 2025
9775d8f
Apply suggestions from code review
picnixz Jun 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify supported separators
  • Loading branch information
picnixz committed Jul 13, 2024
commit cb04947257db1a79316ce673cbddec9f06ba824a
9 changes: 5 additions & 4 deletions src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import atexit
import base64
import builtins
from collections import defaultdict
import glob
import hashlib
import io
Expand Down Expand Up @@ -911,10 +910,12 @@ def _extract_issue_number(issue):
_section_names_lower_nosep = {}

for _section in sections:
_sanitized = re.sub(r'[_ /]', ' ', _section)
# ' ' and '/' are the separators used by known sections
_sanitized = re.sub(r'[ /]', ' ', _section)
_section_words = re.split(r'\s+', _sanitized)
_section_names_lower_nosep[_section] = ''.join(_section_words).lower()
del _sanitized
# '_', '-', ' ' and '/' are the allowed (user) separators
_section_pattern = r'[_\- /]?'.join(map(re.escape, _section_words))
# add '$' to avoid matching after the pattern
_section_pattern = f'{_section_pattern}$'
Expand Down Expand Up @@ -942,8 +943,8 @@ def _extract_section_name(section):
# '_', '-', ' ' and '/' are the allowed (user) separators
sanitized = re.sub(r'[_\- /]', ' ', section)
section_words = re.split(r'\s+', sanitized)
# '_', ' ' and '/' are the separators used by known sections
section_pattern = r'[_ /]'.join(map(re.escape, section_words))
# ' ' and '/' are the separators used by known sections
section_pattern = r'[ /]'.join(map(re.escape, section_words))
section_pattern = re.compile(section_pattern, re.I)
for section_name in sections:
# try to use the input as the pattern to match against known names
Expand Down
0