Skip to content

Commit aef1e0b

Browse files
committed
Use string.lstrip instead of re.sub
1 parent 91f5e97 commit aef1e0b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Tools/i18n/pygettext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
import importlib.machinery
145145
import importlib.util
146146
import os
147-
import re
148147
import sys
149148
import time
150149
import tokenize
@@ -331,7 +330,7 @@ def get_source_comments(source):
331330
for token in tokenize.tokenize(BytesIO(source).readline):
332331
if token.type == tokenize.COMMENT:
333332
# Remove any leading combination of '#' and whitespace
334-
comment = re.sub(r'^[#\s]+', '', token.string)
333+
comment = token.string.lstrip('# \t')
335334
comments[token.start[0]] = comment
336335
return comments
337336

0 commit comments

Comments
 (0)