From fb6b7a2121ab8d54cc0ba3aac702d43f94e8dc30 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Sun, 17 Dec 2023 18:14:05 +0100 Subject: [PATCH] hook: tensorflow: reformat line wrapping Use 120-character lines to reduce amount of line wrapping and make the hook easier to read. --- .../hooks/stdhooks/hook-tensorflow.py | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-tensorflow.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-tensorflow.py index faf220c0b..6a49efe9c 100644 --- a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-tensorflow.py +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-tensorflow.py @@ -10,8 +10,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------ -from PyInstaller.utils.hooks import is_module_satisfies, \ - collect_submodules, collect_data_files +from PyInstaller.utils.hooks import ( + collect_data_files, + collect_submodules, + is_module_satisfies, +) tf_pre_1_15_0 = is_module_satisfies("tensorflow < 1.15.0") tf_post_1_15_0 = is_module_satisfies("tensorflow >= 1.15.0") @@ -31,11 +34,9 @@ "**/*.lib", ] -# Under tensorflow 2.3.0 (the most recent version at the time of writing), -# _pywrap_tensorflow_internal extension module ends up duplicated; once -# as an extension, and once as a shared library. In addition to increasing -# program size, this also causes problems on macOS, so we try to prevent -# the extension module "variant" from being picked up. +# Under tensorflow 2.3.0 (the most recent version at the time of writing), _pywrap_tensorflow_internal extension module +# ends up duplicated; once as an extension, and once as a shared library. In addition to increasing program size, this +# also causes problems on macOS, so we try to prevent the extension module "variant" from being picked up. # # See pyinstaller/pyinstaller-hooks-contrib#49 for details. excluded_submodules = ['tensorflow.python._pywrap_tensorflow_internal'] @@ -47,24 +48,20 @@ def _submodules_filter(x): if tf_pre_1_15_0: # 1.14.x and earlier: collect everything from tensorflow - hiddenimports = collect_submodules('tensorflow', - filter=_submodules_filter) + hiddenimports = collect_submodules('tensorflow', filter=_submodules_filter) datas = collect_data_files('tensorflow', excludes=data_excludes) elif tf_post_1_15_0 and tf_pre_2_2_0: # 1.15.x - 2.1.x: collect everything from tensorflow_core - hiddenimports = collect_submodules('tensorflow_core', - filter=_submodules_filter) + hiddenimports = collect_submodules('tensorflow_core', filter=_submodules_filter) datas = collect_data_files('tensorflow_core', excludes=data_excludes) # Under 1.15.x, we seem to fail collecting a specific submodule, # and need to add it manually... if tf_post_1_15_0 and tf_pre_2_0_0: - hiddenimports += \ - ['tensorflow_core._api.v1.compat.v2.summary.experimental'] + hiddenimports += ['tensorflow_core._api.v1.compat.v2.summary.experimental'] else: # 2.2.0 and newer: collect everything from tensorflow again - hiddenimports = collect_submodules('tensorflow', - filter=_submodules_filter) + hiddenimports = collect_submodules('tensorflow', filter=_submodules_filter) datas = collect_data_files('tensorflow', excludes=data_excludes) # From 2.6.0 on, we also need to explicitly collect keras (due to