From c8ef0e02dd5abf48e5ce64e3f54f40754ee05dbf Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Jun 2023 08:31:31 -0700 Subject: [PATCH] working towards turning pylint back on --- .efrocachemap | 58 +++++++++---------- config/featuresets/featureset_core.py | 2 +- config/spinoffconfig.py | 2 +- src/assets/ba_data/python/babase/_app.py | 20 +++++-- .../ba_data/python/babase/_appconfig.py | 4 +- src/assets/ba_data/python/baenv.py | 4 +- src/meta/bacoremeta/pyembed/binding_core.py | 2 +- tests/test_template_fs/__init__.py | 1 + tests/test_template_fs/test_imports.py | 21 +++++++ tools/batools/androidsdkutils.py | 12 ++-- tools/batools/assetstaging.py | 6 +- tools/batools/dummymodule.py | 5 -- tools/batools/metamakefile.py | 1 - tools/batools/pcommand2.py | 1 - tools/batools/project/_checks.py | 3 - tools/batools/pythonenumsmodule.py | 8 +-- tools/batools/resourcesmakefile.py | 3 - tools/batools/spinoff/_config_template.py | 2 +- tools/batools/spinoff/_context.py | 2 +- tools/batools/spinoff/_main.py | 4 +- 20 files changed, 91 insertions(+), 70 deletions(-) create mode 100644 tests/test_template_fs/__init__.py create mode 100644 tests/test_template_fs/test_imports.py diff --git a/.efrocachemap b/.efrocachemap index 81b1d181..38dca9b6 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f2/47/deeb85392a07c72f30592c01f493", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/41/c3/09b8b77efdc175bb177904a5d4ff", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c3/7f/f6f9c38893a4d57cd9ee608a88ab", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/07/22/830c7e9cc6322e2c579eb58efa92", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/08/b1/3bd935ceb437cb8d2e1758f54af1", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e4/ef/7f26356e00109ca41bd3a15f4c03", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/52/f3/121ca899a51d08c611e9cc6144cd", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/97/ac/04610514fbdfd88a7b1512f217bf", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/df/dd/a7649c88b5f92866e25ab294ab79", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/df/8b/21d4ef5d65a43efce9f7cc2d1c7d", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/01/46/7a1db218c5c2448185cf6dcfedf5", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/57/4f/c0fd4bb760e9d2ebd8bdd846bce1", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/64/ef/ce429e8e501c89a38c42f6749321", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/39/e9/e13f8016e2883f6aa1e418afcd13", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e1/b5/79a889568b25c153f9fcadc583cc", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/80/90/5cda30fff97dcbfaf2f3ccd0accb", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/46/97/4e250671edfa301ddae2ac1f435b", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/5d/b6/9e13f8f84f1532e9f2ba0aa9a356", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/0b/bc/5e71f8fa05dacf9df290cfb2c1d7", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/03/e6/553685865ef7492321af81b42d07", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c6/e8/03ac5abad725ac0387029d2a4142", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/08/c6/f3524cff93ff9a25d78609c1341b", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/10/be/0ea2e0c2ce2ddc41f2e8b9b11b94", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b8/5f/d32d224973c2ced1fdf1b69aa7b1", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/94/b2/e7426f3d931e59bad553ed990a2e", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7b/c1/2dfb7c5fc6a31dd4ac4be9ef69bb", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/af/9b/8de9876d0e3db5ccc49ce80c8e2a", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/16/63/7bedf858ae0dc1e91acf76c1cbd6", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/15/69/0aed1da6e8988e46fd85e0b0b16c", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/cc/d0/f0c1c32c948f5349e91071107d9a", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/16/d9/cb7a9fff79a562baf4729f5b44f3", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/fc/34/1623d3a8d0ff13a71f819300c091", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/2e/c6/4c618fc31c73ccef2e7d8d14ec7e", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/84/38/e6f2c8c7607161c76e7c2d65ffd1", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/59/d0/a56cc7c46a195e874186aff2545f", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/08/dd/98f18c4d39850dafbf3efdfbc305", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/0b/4e/c41ed0ba45b3db377a3f6fe2b591", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/54/51/221829a5b4814bb15c9fb7550e2d", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/b6/f5/289a7c3980b8b10785cf3e7a0c84", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f9/25/5a367595c2f116a5f4c5ff5badea", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2", @@ -4108,20 +4108,20 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6f/26/c227f23af91c96c8b1081f74ff1c", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/8c/c8/4b4312d3c6b3293a37dca0661233", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/61/db/055d73f415ebbcd377f0a7f5cd16", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c5/70/4d6a2171de7316f7d8796f526fc9", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c7/9f/60f9af18ef8fc02018e96cc2ba0d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/59/0c/58ea59ed03c625212ff28ff51092", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/b9/40/be2c8f8da250538230feda77589f", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/6a/49/ac9574ec9359804b019fb71044f9", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/09/9c/85764402b35843e1057494c867dd", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/38/22/b1ba8ab84ecedb8870fd7f122747", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/2a/10/a06ea64b81cc17db35bee9c037c3", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/85/b4/a1fcedeacc282d005fa2c052dcbb", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/0a/1a/de3dc9cd57640e657814826048be", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/dc/97/4f50384b1dbd7972c04278b5c52c", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/28/db/2894bb975eae0b909e78c33aacaa", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/7a/38/764a2c23aa26bf3ce1b549100fd2", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/4e/07/87dd93e7ef29b8b78d0b4791d6f8", "src/ballistica/base/mgen/pyembed/binding_base_app.inc": "https://files.ballistica.net/cache/ba1/ff/44/8e2528bafe71c7fedda6a1e0ac4a", "src/ballistica/classic/mgen/pyembed/binding_classic.inc": "https://files.ballistica.net/cache/ba1/b2/fd/f5c362e9093b2d0721fb59fc0056", - "src/ballistica/core/mgen/pyembed/binding_core.inc": "https://files.ballistica.net/cache/ba1/71/b8/c020cbb7f9a7ce3f347ccadd3df1", + "src/ballistica/core/mgen/pyembed/binding_core.inc": "https://files.ballistica.net/cache/ba1/09/2b/17a249d6cfcb9a3774413f6e9156", "src/ballistica/core/mgen/pyembed/env.inc": "https://files.ballistica.net/cache/ba1/49/37/a092e0e385093479c14d47c86b27", "src/ballistica/core/mgen/python_modules_monolithic.h": "https://files.ballistica.net/cache/ba1/e4/87/ca448e63b14d8c292e2c32c35d5d", "src/ballistica/scene_v1/mgen/pyembed/binding_scene_v1.inc": "https://files.ballistica.net/cache/ba1/4d/d5/a6e9feabfdf60ac6d78ee7983427", diff --git a/config/featuresets/featureset_core.py b/config/featuresets/featureset_core.py index 9791b86d..79658f97 100644 --- a/config/featuresets/featureset_core.py +++ b/config/featuresets/featureset_core.py @@ -1,6 +1,6 @@ # Released under the MIT License. See LICENSE for details. # -# pylint: disable=missing-docstring, invalid-name +# pylint: disable=missing-module-docstring, invalid-name from __future__ import annotations # This file is exec'ed by the spinoff system, allowing us to define diff --git a/config/spinoffconfig.py b/config/spinoffconfig.py index 758bdd52..fb2a8a9f 100644 --- a/config/spinoffconfig.py +++ b/config/spinoffconfig.py @@ -1,6 +1,6 @@ # Released under the MIT License. See LICENSE for details. # -# pylint: disable=missing-docstring, invalid-name +# pylint: disable=invalid-name from __future__ import annotations # This file is exec'ed by tools/spinoff, allowing us to customize diff --git a/src/assets/ba_data/python/babase/_app.py b/src/assets/ba_data/python/babase/_app.py index c76a1e00..99308cd3 100644 --- a/src/assets/ba_data/python/babase/_app.py +++ b/src/assets/ba_data/python/babase/_app.py @@ -513,8 +513,6 @@ class App: if self.plus is not None: self.plus.on_app_launching() - # self.accounts.on_app_launching() - # Make sure this runs after we init our plus, since # classic accounts here key off of our v2 ones in plus. if self.classic is not None: @@ -544,6 +542,12 @@ class App: """ assert _babase.in_logic_thread() + # Normally plus tells us when initial sign-in is done. If it's + # not present, however, we just do that ourself so we can + # proceed on to the running state. + if self.plus is None: + _babase.pushcall(self.on_initial_sign_in_completed) + def on_app_running(self) -> None: """Called when the app enters the running state. @@ -708,14 +712,16 @@ class App: def read_config(self) -> None: """(internal)""" - from babase._appconfig import read_config + from babase._appconfig import read_app_config - self._config, self.config_file_healthy = read_config() + self._config, self.config_file_healthy = read_app_config() def handle_deep_link(self, url: str) -> None: """Handle a deep link URL.""" from babase._language import Lstr + assert _babase.in_logic_thread() + appname = _babase.appname() if url.startswith(f'{appname}://code/'): code = url.replace(f'{appname}://code/', '') @@ -733,13 +739,17 @@ class App: def on_initial_sign_in_completed(self) -> None: """Callback to be run after initial sign-in (or lack thereof). + This normally gets called by the plus subsystem. This period includes things such as syncing account workspaces or other data so it may take a substantial amount of time. This should also run after a short amount of time if no login has occurred. """ + assert _babase.in_logic_thread() + assert not self._initial_sign_in_completed + # Tell meta it can start scanning extra stuff that just showed up - # (account workspaces). + # (namely account workspaces). self.meta.start_extra_scan() self._initial_sign_in_completed = True diff --git a/src/assets/ba_data/python/babase/_appconfig.py b/src/assets/ba_data/python/babase/_appconfig.py index f5070c3c..06f26ab3 100644 --- a/src/assets/ba_data/python/babase/_appconfig.py +++ b/src/assets/ba_data/python/babase/_appconfig.py @@ -94,8 +94,8 @@ class AppConfig(dict): self.commit() -def read_config() -> tuple[AppConfig, bool]: - """Read the game config.""" +def read_app_config() -> tuple[AppConfig, bool]: + """Read the app config.""" import os import json diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index e1304617..f7928e00 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -78,10 +78,8 @@ def configure( affecting where those modules get loaded from. """ # pylint: disable=too-many-branches - # pylint: disable=too-many-locals - # pylint: disable=too-many-statements - global _g_env_config # pylint: disable=global-statement, invalid-name + global _g_env_config # pylint: disable=global-statement if _g_env_config is not None: raise RuntimeError('An EnvConfig has already been created.') diff --git a/src/meta/bacoremeta/pyembed/binding_core.py b/src/meta/bacoremeta/pyembed/binding_core.py index a15e2dda..5a34ca8c 100644 --- a/src/meta/bacoremeta/pyembed/binding_core.py +++ b/src/meta/bacoremeta/pyembed/binding_core.py @@ -2,7 +2,7 @@ # Where most of our python-c++ binding happens. # Python objects should be added here along with their associated c++ enum. # Run make update to update the project after editing this.. -# pylint: disable=missing-module-docstring, line-too-long +# pylint: disable=missing-module-docstring from __future__ import annotations import json diff --git a/tests/test_template_fs/__init__.py b/tests/test_template_fs/__init__.py new file mode 100644 index 00000000..867b1714 --- /dev/null +++ b/tests/test_template_fs/__init__.py @@ -0,0 +1 @@ +# Released under the MIT License. See LICENSE for details. diff --git a/tests/test_template_fs/test_imports.py b/tests/test_template_fs/test_imports.py new file mode 100644 index 00000000..bd07b2d3 --- /dev/null +++ b/tests/test_template_fs/test_imports.py @@ -0,0 +1,21 @@ +# Released under the MIT License. See LICENSE for details. +# +"""Testing asset manager functionality.""" + +from __future__ import annotations + +import pytest + +from batools import testrun + + +@pytest.mark.skipif( + testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason() +) +def test_imports() -> None: + """Test imports for our featureset.""" + + # Make sure our package and binary module can be cleanly imported by + # themselves. + testrun.run_command('import batemplatefs') + testrun.run_command('import _batemplatefs') diff --git a/tools/batools/androidsdkutils.py b/tools/batools/androidsdkutils.py index fdf044bd..4e4d0c72 100755 --- a/tools/batools/androidsdkutils.py +++ b/tools/batools/androidsdkutils.py @@ -19,10 +19,12 @@ def _parse_lprop_file(local_properties_path: str) -> str: lines = infile.read().splitlines() sdk_dir_lines = [l for l in lines if 'sdk.dir=' in l] if len(sdk_dir_lines) != 1: - raise Exception("Couldn't find sdk dir in local.properties") + raise RuntimeError("Couldn't find sdk dir in local.properties.") sdk_dir = sdk_dir_lines[0].split('=')[1].strip() if not os.path.isdir(sdk_dir): - raise Exception(f'Sdk dir from local.properties not found: {sdk_dir}.') + raise RuntimeError( + f'Sdk dir from local.properties not found: {sdk_dir}.' + ) return sdk_dir @@ -110,7 +112,7 @@ def run(projroot: str, args: list[str]) -> None: # Sanity check; look for a few things in the sdk that we expect to # be there. if not os.path.isfile(sdk_dir + '/platform-tools/adb'): - raise Exception( + raise RuntimeError( 'ERROR: android sdk at "' + sdk_dir + '" does not seem valid' ) @@ -152,7 +154,7 @@ def run(projroot: str, args: list[str]) -> None: ver = lines[0].strip().replace("'", '').replace('"', '').split()[-1] path = os.path.join(sdk_dir, 'ndk', ver) if not os.path.isdir(path): - raise Exception(f'NDK listed in gradle not found: {path}') + raise RuntimeError(f'NDK listed in gradle not found: {path}.') print(path) if command == 'get-adb-path': @@ -160,7 +162,7 @@ def run(projroot: str, args: list[str]) -> None: adbpath = Path(sdk_dir, 'platform-tools/adb') if not os.path.exists(adbpath): - raise Exception(f'ADB not found at expected path {adbpath}') + raise RuntimeError(f"ADB not found at expected path '{adbpath}'.") # Ok, we've got a valid adb path. # Now, for extra credit, let's see if 'which adb' points to the diff --git a/tools/batools/assetstaging.py b/tools/batools/assetstaging.py index 72cc4311..a33e1e4b 100755 --- a/tools/batools/assetstaging.py +++ b/tools/batools/assetstaging.py @@ -200,7 +200,7 @@ def _run(cmd: str, echo: bool = False) -> None: print(cmd) result = os.system(cmd) if result != 0: - raise Exception("error running cmd: '" + cmd + "'") + raise RuntimeError(f"Error running cmd: '{cmd}'.") def _write_payload_file(assets_root: str, full: bool) -> None: @@ -251,7 +251,9 @@ def _sync_windows_extras(cfg: Config) -> None: assert cfg.win_platform is not None assert cfg.win_type is not None if not os.path.isdir(cfg.win_extras_src): - raise Exception('win extras src dir not found: ' + cfg.win_extras_src) + raise RuntimeError( + "Win extras src dir not found: '{cfg.win_extras_src}'." + ) # Ok, lets do full syncs on each subdir we find so we # properly delete anything in dst that disappeared from src. diff --git a/tools/batools/dummymodule.py b/tools/batools/dummymodule.py index 56cd3431..005cb581 100755 --- a/tools/batools/dummymodule.py +++ b/tools/batools/dummymodule.py @@ -645,8 +645,6 @@ def _formatdoc( def _writeclasses(module: ModuleType, classnames: Sequence[str]) -> str: # pylint: disable=too-many-branches - # pylint: disable=too-many-locals - # pylint: disable=too-many-statements from batools.docs import parse_docs_attrs out = '' @@ -754,9 +752,6 @@ class Generator: def run(self) -> None: """Run the actual generation from within the app context.""" - # pylint: disable=too-many-locals - # pylint: disable=too-many-branches - # pylint: disable=too-many-statements from efrotools import get_public_license from efrotools.code import format_python_str diff --git a/tools/batools/metamakefile.py b/tools/batools/metamakefile.py index 5cfba591..3cc1784d 100755 --- a/tools/batools/metamakefile.py +++ b/tools/batools/metamakefile.py @@ -80,7 +80,6 @@ class MetaMakefileGenerator: def run(self) -> dict[str, str]: """Do the thing.""" # pylint: disable=too-many-locals - # pylint: disable=too-many-statements public = getconfig(Path(self._projroot))['public'] assert isinstance(public, bool) diff --git a/tools/batools/pcommand2.py b/tools/batools/pcommand2.py index f6e4ab2a..451f62c0 100644 --- a/tools/batools/pcommand2.py +++ b/tools/batools/pcommand2.py @@ -1,6 +1,5 @@ # Released under the MIT License. See LICENSE for details. # -# pylint: disable=too-many-lines """A nice collection of ready-to-use pcommands for this package.""" from __future__ import annotations diff --git a/tools/batools/project/_checks.py b/tools/batools/project/_checks.py index 475ce3ea..4f4135d0 100755 --- a/tools/batools/project/_checks.py +++ b/tools/batools/project/_checks.py @@ -53,9 +53,6 @@ def _source_file_feature_set_namespace_check( self: ProjectUpdater, fname: str, lines: list[str] ) -> None: """Make sure C++ code uses correct namespaces based on its location.""" - # pylint: disable=too-many-branches - # if bool(True): - # return # Extensions we know we're skipping. if any(fname.endswith(x) for x in ['.c', '.swift']): diff --git a/tools/batools/pythonenumsmodule.py b/tools/batools/pythonenumsmodule.py index c2145eb0..d40259f3 100755 --- a/tools/batools/pythonenumsmodule.py +++ b/tools/batools/pythonenumsmodule.py @@ -65,7 +65,7 @@ def _parse_name(lines: list[str], lnum: int) -> str: or bits[1] != 'class' or bits[3] != '{' ): - raise Exception(f'Unexpected format for enum on line {lnum + 1}.') + raise RuntimeError(f'Unexpected format for enum on line {lnum + 1}.') enum_name = bits[2] return enum_name @@ -121,7 +121,7 @@ def _find_enum_end(lines: list[str], lnum: int) -> int: lnumend = lnum + 1 while True: if lnumend > len(lines) - 1: - raise Exception(f'No end found for enum on line {lnum + 1}.') + raise RuntimeError(f'No end found for enum on line {lnum + 1}.') if '};' in lines[lnumend]: break lnumend += 1 @@ -134,13 +134,13 @@ def _parse_doc_lines(lines: list[str], lnum: int) -> tuple[list[str], int]: lnumorig = lnum while True: if lnum > len(lines) - 1: - raise Exception( + raise RuntimeError( f'No end found for enum docstr line {lnumorig + 1}.' ) if lines[lnum].startswith('enum class '): break if not lines[lnum].startswith('///'): - raise Exception(f'Invalid docstr at line {lnum + 1}.') + raise RuntimeError(f'Invalid docstr at line {lnum + 1}.') doclines.append(lines[lnum][4:]) lnum += 1 return doclines, lnum diff --git a/tools/batools/resourcesmakefile.py b/tools/batools/resourcesmakefile.py index 131d238a..df0f5f63 100755 --- a/tools/batools/resourcesmakefile.py +++ b/tools/batools/resourcesmakefile.py @@ -57,9 +57,6 @@ class ResourcesMakefileGenerator: existing_data: str, projname: str, ) -> None: - # pylint: disable=too-many-locals - # pylint: disable=too-many-statements - from efrotools import getconfig self.public = getconfig(Path(projroot))['public'] diff --git a/tools/batools/spinoff/_config_template.py b/tools/batools/spinoff/_config_template.py index 83913f82..7c16ec7a 100644 --- a/tools/batools/spinoff/_config_template.py +++ b/tools/batools/spinoff/_config_template.py @@ -1,6 +1,6 @@ # Released under the MIT License. See LICENSE for details. # -# pylint: disable=missing-docstring, invalid-name +# pylint: disable=useless-suppression, disable=invalid-name, missing-docstring # A TEMPLATE CONFIG FOR CREATED SPINOFF DST PROJECTS. # THIS IS NOT USED AT RUNTIME; IT ONLY EXISTS FOR TYPE-CHECKING PURPOSES. diff --git a/tools/batools/spinoff/_context.py b/tools/batools/spinoff/_context.py index eb6bc209..af75b5e6 100644 --- a/tools/batools/spinoff/_context.py +++ b/tools/batools/spinoff/_context.py @@ -578,6 +578,7 @@ class SpinoffContext: ) def _generate_env_hash(self) -> None: + # pylint: disable=cyclic-import from efrotools import get_files_hash import batools.spinoff import batools.project @@ -1125,7 +1126,6 @@ class SpinoffContext: def _override(self) -> None: """Add one or more overrides.""" - # pylint: disable=eval-used try: override_paths, src_paths = self._check_override_paths() diff --git a/tools/batools/spinoff/_main.py b/tools/batools/spinoff/_main.py index d858d940..fe1f949d 100644 --- a/tools/batools/spinoff/_main.py +++ b/tools/batools/spinoff/_main.py @@ -14,7 +14,6 @@ from typing import assert_never from efro.error import CleanError from efro.terminal import Clr from efrotools import replace_exact -import batools.spinoff from batools.spinoff._context import SpinoffContext @@ -128,10 +127,11 @@ def _main() -> None: def _do_create(src_root: str | None, dst_root: str) -> None: - # pylint: disable=too-many-locals + # pylint: disable=too-many-locals, cyclic-import from efrotools import extract_arg, extract_flag from efrotools.code import format_python_str from efrotools import getconfig + import batools.spinoff # Note: in our case dst_root is actualy what becomes the src project # should clean up these var names to make that clearer.