Skip to content

Commit 56e2fe3

Browse files
committed
[NFC] Ruff format file
1 parent 011c224 commit 56e2fe3

File tree

1 file changed

+76
-76
lines changed

1 file changed

+76
-76
lines changed

bindings/pyroot/pythonizations/test/import_load_libs.py

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import unittest
2-
import re
31
import os
2+
import re
3+
import unittest
44

55

66
class ImportLoadLibs(unittest.TestCase):
@@ -11,71 +11,71 @@ class ImportLoadLibs(unittest.TestCase):
1111
# The whitelist is a list of regex expressions that mark wanted libraries
1212
# Note that the regex has to result in an exact match with the library name.
1313
known_libs = [
14-
# libCore and dependencies
15-
'libCore',
16-
'libm',
17-
'liblz4',
18-
'libxxhash',
19-
'liblzma',
20-
'libzstd',
21-
'libz',
22-
'libpthread',
23-
'libc',
24-
'libdl',
25-
'libpcre',
26-
'libpcre2-8',
27-
# libCling and dependencies
28-
'libCling.*',
29-
'librt',
30-
'libncurses.*',
31-
'libtinfo', # by libncurses (on some older platforms)
32-
# libTree and dependencies
33-
'libTree',
34-
'libThread',
35-
'libRIO',
36-
'libNet',
37-
'libImt',
38-
'libMathCore',
39-
'libMultiProc',
40-
'libssl',
41-
'libcrypt.*', # by libssl
42-
'libtbb',
43-
'libtbb_debug',
44-
'libtbbmalloc',
45-
'liburing', # by libRIO if uring option is enabled
46-
'libgomp', # by adaptivecpp
47-
# On centos7 libssl links against kerberos pulling in all dependencies below, removed with libssl1.1.0
48-
'libgssapi_krb5',
49-
'libkrb5',
50-
'libk5crypto',
51-
'libkrb5support',
52-
'libselinux',
53-
'libkeyutils',
54-
'libcom_err',
55-
'libresolv',
56-
# cppyy and Python libraries
57-
'libcppyy.*',
58-
'libROOTPythonizations.*',
59-
'libpython.*',
60-
'libutil.*',
61-
'.*cpython.*',
62-
'_.*',
63-
'.*module',
64-
'operator',
65-
'cStringIO',
66-
'binascii',
67-
'libbz2',
68-
'libexpat',
69-
'ISO8859-1',
70-
# System libraries and others
71-
'libnss_.*',
72-
'ld.*',
73-
'libffi',
74-
'libgcc_s',
75-
# AddressSanitizer runtime and ROOT configuration
76-
'libclang_rt.asan-.*',
77-
'libROOTSanitizerConfig',
78-
]
14+
# libCore and dependencies
15+
"libCore",
16+
"libm",
17+
"liblz4",
18+
"libxxhash",
19+
"liblzma",
20+
"libzstd",
21+
"libz",
22+
"libpthread",
23+
"libc",
24+
"libdl",
25+
"libpcre",
26+
"libpcre2-8",
27+
# libCling and dependencies
28+
"libCling.*",
29+
"librt",
30+
"libncurses.*",
31+
"libtinfo", # by libncurses (on some older platforms)
32+
# libTree and dependencies
33+
"libTree",
34+
"libThread",
35+
"libRIO",
36+
"libNet",
37+
"libImt",
38+
"libMathCore",
39+
"libMultiProc",
40+
"libssl",
41+
"libcrypt.*", # by libssl
42+
"libtbb",
43+
"libtbb_debug",
44+
"libtbbmalloc",
45+
"liburing", # by libRIO if uring option is enabled
46+
"libgomp", # by adaptivecpp
47+
# On centos7 libssl links against kerberos pulling in all dependencies below, removed with libssl1.1.0
48+
"libgssapi_krb5",
49+
"libkrb5",
50+
"libk5crypto",
51+
"libkrb5support",
52+
"libselinux",
53+
"libkeyutils",
54+
"libcom_err",
55+
"libresolv",
56+
# cppyy and Python libraries
57+
"libcppyy.*",
58+
"libROOTPythonizations.*",
59+
"libpython.*",
60+
"libutil.*",
61+
".*cpython.*",
62+
"_.*",
63+
".*module",
64+
"operator",
65+
"cStringIO",
66+
"binascii",
67+
"libbz2",
68+
"libexpat",
69+
"ISO8859-1",
70+
# System libraries and others
71+
"libnss_.*",
72+
"ld.*",
73+
"libffi",
74+
"libgcc_s",
75+
# AddressSanitizer runtime and ROOT configuration
76+
"libclang_rt.asan-.*",
77+
"libROOTSanitizerConfig",
78+
]
7979

8080
# Verbose mode of the test
8181
verbose = False
@@ -94,30 +94,30 @@ def test_import(self):
9494
libs = libs.split(' ')
9595

9696
# Get library name without full path and .so* suffix
97-
libs = [os.path.basename(l).split('.so')[0] for l in libs \
98-
if not l.startswith('-l') and not l.startswith('-L')]
97+
libs = [os.path.basename(lib).split('.so')[0] for lib in libs \
98+
if not lib.startswith('-l') and not lib.startswith('-L')]
9999

100100
# Check that the loaded libraries are white listed
101101
bad_libs = []
102102
good_libs = []
103103
matched_re = []
104-
for l in libs:
104+
for lib in libs:
105105
matched = False
106106
for r in self.known_libs:
107-
m = re.match(r, l)
107+
m = re.match(r, lib)
108108
if m:
109-
if m.group(0) == l:
109+
if m.group(0) == lib:
110110
matched = True
111-
good_libs.append(l)
111+
good_libs.append(lib)
112112
matched_re.append(r)
113113
break
114114
if not matched:
115-
bad_libs.append(l)
115+
bad_libs.append(lib)
116116

117117
if self.verbose:
118118
print('Found whitelisted libraries after importing ROOT with the shown regex match:')
119-
for l, r in zip(good_libs, matched_re):
120-
print(' - {} ({})'.format(l, r))
119+
for lib, r in zip(good_libs, matched_re):
120+
print(' - {} ({})'.format(lib, r))
121121
import sys
122122
sys.stdout.flush()
123123

0 commit comments

Comments
 (0)