Browse Source

build: fix python warnings "SyntaxWarning: invalid escape sequence '\w'" (#44660)

* fix: SyntaxWarning: invalid escape sequence '\w'

Co-authored-by: Charles Kerr <[email protected]>

* chore: remove some unused imports

Co-authored-by: Charles Kerr <[email protected]>

* fix: E711 warning 'Comparison to should be '

Co-authored-by: Charles Kerr <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <[email protected]>
trop[bot] 5 months ago
parent
commit
e95e6fac0d
3 changed files with 4 additions and 5 deletions
  1. 1 1
      build/generate_node_defines.py
  2. 2 3
      script/generate-config-gypi.py
  3. 1 1
      script/zip-symbols.py

+ 1 - 1
build/generate_node_defines.py

@@ -2,7 +2,7 @@ import os
 import re
 import sys
 
-DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
+DEFINE_EXTRACT_REGEX = re.compile(r'^ *# *define (\w*)', re.MULTILINE)
 
 def main(out_dir, headers):
   defines = []

+ 2 - 3
script/generate-config-gypi.py

@@ -6,7 +6,6 @@ import pprint
 import re
 import subprocess
 import sys
-from lib.config import get_target_arch
 
 ELECTRON_DIR = os.path.abspath(os.path.join(__file__, '..', '..'))
 NODE_DIR = os.path.join(ELECTRON_DIR, '..', 'third_party', 'electron_node')
@@ -40,8 +39,8 @@ def read_electron_args():
     for line in file_in:
       if line.startswith('#'):
         continue
-      m = re.match('(\w+) = (.+)', line)
-      if m == None:
+      m = re.match(r'(\w+) = (.+)', line)
+      if m is None:
         continue
       args[m.group(1)] = m.group(2)
   return args

+ 1 - 1
script/zip-symbols.py

@@ -5,7 +5,7 @@ import glob
 import os
 import sys
 
-from lib.config import PLATFORM, get_target_arch
+from lib.config import PLATFORM
 from lib.util import scoped_cwd, get_electron_version, make_zip, \
                      get_electron_branding, get_out_dir, execute