Skip to content

Commit 983f825

Browse files
committed
Simplify patterns for newline handling.
1 parent 7506662 commit 983f825

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

path/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858

5959
LINESEPS = ['\r\n', '\r', '\n']
6060
U_LINESEPS = LINESEPS + ['\u0085', '\u2028', '\u2029']
61-
U_NEWLINE = re.compile('|'.join(U_LINESEPS))
6261
B_NEWLINE = re.compile('|'.join(LINESEPS).encode())
63-
B_NL_END = re.compile(f'(?:{B_NEWLINE.pattern.decode()})$'.encode())
64-
U_NL_END = re.compile(f'(?:{U_NEWLINE.pattern})$')
62+
U_NEWLINE = re.compile('|'.join(U_LINESEPS))
63+
B_NL_END = re.compile(B_NEWLINE.pattern + b'$')
64+
U_NL_END = re.compile(U_NEWLINE.pattern + '$')
6565

6666

6767
class TreeWalkWarning(Warning):

0 commit comments

Comments
 (0)