8000 ternary operators need parentheses · lineCode/opencv-python@07e5646 · GitHub
[go: up one dir, main page]

Skip to content

Commit 07e5646

Browse files
committed
ternary operators need parentheses
1 parent 62fe1dc commit 07e5646

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

setup.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def main():
3131
use_depth = g.get_git_version() >= type(g.get_git_version())("1.8.4")
3232

3333
g.run_command(["submodule", "update", "--init", "--recursive"] +
34-
["--depth=1"] if use_depth else [] +
34+
(["--depth=1"] if use_depth else []) +
3535
[cmake_source_dir])
3636

3737
if build_contrib:
3838
g.run_command(["submodule", "update", "--init", "--recursive"] +
39-
["--depth=1"] if use_depth else [] +
39+
(["--depth=1"] if use_depth else []) +
4040
["opencv_contrib"])
4141

4242
del use_depth, g, pip
@@ -52,7 +52,7 @@ def main():
5252
package_data = {
5353
'cv2':
5454
['*%s' % sysconfig.get_config_var('SO')] +
55-
['*.dll'] if os.name == 'nt' else [] +
55+
(['*.dll'] if os.name == 'nt' else []) +
5656
["LICENSE.txt", "LICENSE-3RD-PARTY.txt"],
5757
'cv2.data':
5858
["*.xml"]
@@ -61,7 +61,7 @@ def main():
6161
# Files from CMake output to copy to package.
6262
# Path regexes with forward slashes relative to CMake install dir.
6363
rearrange_cmake_output_data = {
64-
'cv2': [r'bin/opencv_ffmpeg\d{3}%s\.dll' % ('_64' if x64 else '')] if os.name == 'nt' else [] +
64+
'cv2': ([r'bin/opencv_ffmpeg\d{3}%s\.dll' % ('_64' if x64 else '')] if os.name == 'nt' else []) +
6565
# In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
6666
# Naming conventions vary so widely between versions and OSes
6767
# had to give up on checking them.
@@ -78,11 +78,11 @@ def main():
7878
'cv2': ['LICENSE.txt', & 10000 #39;LICENSE-3RD-PARTY.txt']
7979
}
8080

81-
cmake_args = [
81+
cmake_args = ([
8282
"-G", "Visual Studio 14" + (" Win64" if x64 else '')
8383
] if os.name == 'nt' else [
8484
"-G", "Unix Makefiles" # don't make CMake try (and fail) Ninja first
85-
] + [
85+
]) + [
8686
# skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3
8787
"-DPYTHON%d_EXECUTABLE=%s" % (sys.version_info[0], sys.executable),
8888
"-DBUILD_opencv_python%d=ON" % sys.version_info[0],
@@ -95,7 +95,7 @@ def main():
9595
"-DBUILD_TESTS=OFF",
9696
"-DBUILD_PERF_TESTS=OFF",
9797
"-DBUILD_DOCS=OFF"
98-
] + ["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")] if build_contrib else []
98+
] + (["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")] if build_contrib else [])
9999

100100
# OS-specific components
101101
if sys.platform == 'darwin' or sys.platform.startswith('linux'):
@@ -280,7 +280,6 @@ def _classify_files_override(self, install_paths,
280280
)
281281
final_install_relpaths.append(new_install_relpath)
282282

283-
284283
final_install_paths = [os.path.join(cmake_install_dir, p) for p in final_install_relpaths]
285284

286285
return (cls.wraps._classify_files)(
@@ -329,8 +328,7 @@ def get_or_install(name, version=None):
329328
js_packages = json.loads(
330329
subprocess.check_output([sys.executable, "-m", "pip", "list", "--format", "json"]).decode('ascii')) # valid names & versions are ASCII as per PEP 440
331330
try:
332-
[package] = (package for package in js_packages
333-
if package['name'] == name)
331+
[package] = (package for package in js_packages if package['name'] == name)
334332
except ValueError:
335333
install_packages("%s==%s" % (name, version) if version else name)
336334
return version

0 commit comments

Comments
 (0)
0