-
-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
bugSomething isn't workingSomething isn't workingchangelogChanges should be written to the changelog file.Changes should be written to the changelog file.
Description
We've recently started getting the below failure.
Traceback (most recent call last):
File "/home/gordon/.cache/pre-commit/repotvgski9p/py_env-python3/bin/unimport", line 8, in <module>
sys.exit(main())
File "/home/gordon/.cache/pre-commit/repotvgski9p/py_env-python3/lib/python3.10/site-packages/unimport/main.py", line 26, in main
for path in config.get_paths():
File "/home/gordon/.cache/pre-commit/repotvgski9p/py_env-python3/lib/python3.10/site-packages/unimport/config.py", line 72, in get_paths
yield from utils.list_paths(
File "/home/gordon/.cache/pre-commit/repotvgski9p/py_env-python3/lib/python3.10/site-packages/unimport/utils.py", line 117, in list_paths
include_regex, exclude_regex = re.compile(include), re.compile(exclude)
File "/usr/lib/python3.10/re.py", line 251, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.10/re.py", line 303, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.10/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.10/sre_parse.py", line 950, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.10/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.10/sre_parse.py", line 836, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.10/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.10/sre_parse.py", line 833, in _parse
raise source.error(err.msg, len(name) + 1) from None
re.error: redefinition of group name 'ps_d' as group 2; was group 1 at position 72
We're running with py3.10.4, and this bit of precommit
- repo: https://github.com/hakancelik96/unimport
rev: 0.11.1
hooks:
- id: unimport
args: [--remove, --include-star-import, --ignore-init, --gitignore]
It looks like this was caused by our use of --gitignore and the recent (10 hours ago at the time of writing) release of pathspec 0.10.0.
Digging into it I'm seeing that it's taken every line from our .gitignore and wrapped it, so /prof has become ^prof(?:(?P<ps_d>/).*)?$ that seems to come from GitWildMatchPattern
kayhoogland, MarcinWronecki, WarKaa and amitkparekh
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingchangelogChanges should be written to the changelog file.Changes should be written to the changelog file.