Skip to content

Commit

Permalink
Simplify patterns for newline handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jul 26, 2021
1 parent 7506662 commit 983f825
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@

LINESEPS = ['\r\n', '\r', '\n']
U_LINESEPS = LINESEPS + ['\u0085', '\u2028', '\u2029']
U_NEWLINE = re.compile('|'.join(U_LINESEPS))
B_NEWLINE = re.compile('|'.join(LINESEPS).encode())
B_NL_END = re.compile(f'(?:{B_NEWLINE.pattern.decode()})$'.encode())
U_NL_END = re.compile(f'(?:{U_NEWLINE.pattern})$')
U_NEWLINE = re.compile('|'.join(U_LINESEPS))
B_NL_END = re.compile(B_NEWLINE.pattern + b'$')
U_NL_END = re.compile(U_NEWLINE.pattern + '$')


class TreeWalkWarning(Warning):
Expand Down

0 comments on commit 983f825

Please sign in to comment.