micropython / micropython/micropython-lib
textwrap module not usable with MicroPython ure
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
I have a port of MicroPython which includes the ure module. I tried to bring in the textwrap module from this project, but ran into a couple of issues:
wordsep_re = re.compile(
r'(\s+|' # any whitespace
r'[^\s\w]*\w+[^0-9\W]-(?=\w+[^0-9\W])|' # hyphenated words
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
This regular expression does not compile cleanly as ure does not support the (?= notation
_whitespace_only_re = re.compile('^[ \t]+$', re.MULTILINE)
_leading_whitespace_re = re.compile('(^[ \t]*)(?:[^ \t\n])', re.MULTILINE)
These two also fail to compile, in this case because the MULTILINE flag is missing
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the textwrap module and the definitions of wordsep_re, _whitespace_only_re, and _leading_whitespace_re. Check MicroPython ure's supported syntax and flags, then verify that text wrapping works with ure without compilation errors; the issue is resolved when these expressions are compatible with the reported port.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100