From c1baefeda462a00cdace27080e5b38603cb4036c Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Jun 2023 11:25:20 -0700 Subject: [PATCH] more pylint and pycharm cleanup --- .efrocachemap | 60 +++++++++---------- CHANGELOG.md | 2 +- config/featuresets/featureset_base.py | 2 +- src/assets/ba_data/python/babase/_app.py | 1 - .../ba_data/python/babase/_appmodeselector.py | 2 - src/assets/ba_data/python/babase/_asyncio.py | 4 +- src/assets/ba_data/python/babase/_general.py | 2 +- src/assets/ba_data/python/baenv.py | 2 +- .../base/python/methods/python_methods_app.cc | 4 +- src/ballistica/shared/ballistica.cc | 2 +- src/meta/babasemeta/pyembed/binding_base.py | 4 ++ .../babasemeta/pyembed/binding_base_app.py | 2 +- tools/batools/dummymodule.py | 10 +++- tools/efrotools/code.py | 9 ++- 14 files changed, 60 insertions(+), 46 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 5a8997ed..4c24759c 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/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/b9/94/14e96f6497e7d79148194ee6a7cb", - "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/4c/2e/475331e7531640a05e43b4a08120", - "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/fb/bd/4395fa6dc06f077fe0cc5c5b4be1", - "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/18/4a/3df0a4f45e6aeb92341194b3405c", - "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/14/b1/12cff0cf6314c5476e6c7f6920a5", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/75/c7/48d7c37f280b875e398cb340f533", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/07/ea/fc994e8da3d8eb2d397a84e0c375", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/0f/08/4c5d8367112ee73bc9d239e2b05a", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/71/15/57a530b858d86ba9dfa41023effb", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/8e/14/1c68ac731dc3698542ae424d26ee", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/26/55/a4839897d87e4230d7292dd522e5", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/f7/91/11183fa100f6863716f11d1bc15f", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/7a/9b/3f28c4332e749ae260e8c0ad973d", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/d0/51/78348034f076671655b4268471f2", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7f/78/b502c2ebabc76947ea3271857d39", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7e/1b/5de185765be64965dc78c6cd4e65", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/ab/f2/a834a306fc65a6d989162f016d15", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/c8/3a/cc813fbcbf3de27e99ffa2c49c83", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/35/a2/938b7e029bdfae20c5871e7612ff", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e1/58/2f21394b48d3ffa1d2db067c5873", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/48/69/e1071029495cc3030b4e97baa959", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/98/3d/e739287bb91e8a3c66143d847c46", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/fb/3a/6e595d81d6a24293c7626ba57620", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/70/22/e4a161772eb81517af6d684c6adf", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/42/6d/89c22399503646a09d17a5ffd265", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/71/3d/4e3b05e2139ddeeaca7a9516d359", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/78/57/b254b253032d31a05850c74a868c", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/2d/89/1a01696f6ed0e8882df9bdce9c40", "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,18 +4108,18 @@ "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/4f/69/a8254d42f8347e4951fc479a1d39", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/49/1a/d361e1f0f1d0d8f68fb2b3f8e2f5", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/33/34/524165a684cc56828dc7cb1be254", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/45/9c/def4dc35037b5da3b43a85473cda", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6e/8b/60bbd66f58dd133af1904420905d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e8/dd/0ed0c7ef302308d47c2e898f46f9", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/5c/13/53ebf825ed88053908d7952359f0", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c1/e4/c1a3657c0e255d5e348436b374c7", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/4c/1e/9f1e7d2c79cfe7d012453e98209b", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/8b/13/e584a4cd61cdde4636fbd43586cc", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/e6/e2/09a91d25f903cadd653c9b530d2b", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d9/93/e007b82c50e019690ee61e72d847", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/50/a5/14b0b319f0c9e18a72cae8f18432", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/1a/9a/6adcdb3c87c7db6d9a31d9527926", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/03/dc/954de197cd62e0e4bee19b040777", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/15/1d/aa3f018074c2e6b79a81915db7da", "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/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/75/9f/bcf597b362c9f2480cb348188bdd", + "src/ballistica/base/mgen/pyembed/binding_base_app.inc": "https://files.ballistica.net/cache/ba1/ba/0a/f528c175ef4cea9d50431cd768a8", "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/09/2b/17a249d6cfcb9a3774413f6e9156", "src/ballistica/core/mgen/pyembed/env.inc": "https://files.ballistica.net/cache/ba1/49/37/a092e0e385093479c14d47c86b27", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7bf9c9..ee6b8ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21048, api 8, 2023-06-05) +### 1.7.20 (build 21049, api 8, 2023-06-06) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/config/featuresets/featureset_base.py b/config/featuresets/featureset_base.py index 97f52ecf..0704a845 100644 --- a/config/featuresets/featureset_base.py +++ b/config/featuresets/featureset_base.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/src/assets/ba_data/python/babase/_app.py b/src/assets/ba_data/python/babase/_app.py index b476cf48..3f738c61 100644 --- a/src/assets/ba_data/python/babase/_app.py +++ b/src/assets/ba_data/python/babase/_app.py @@ -422,7 +422,6 @@ class App: # If the app-mode for this intent is different than the active # one, switch. - # pylint: disable=unidiomatic-typecheck if type(mode) is not type(self._mode): if self._mode is None: is_initial_mode = True diff --git a/src/assets/ba_data/python/babase/_appmodeselector.py b/src/assets/ba_data/python/babase/_appmodeselector.py index 3ccefe1d..f89e4fe8 100644 --- a/src/assets/ba_data/python/babase/_appmodeselector.py +++ b/src/assets/ba_data/python/babase/_appmodeselector.py @@ -21,8 +21,6 @@ class AppModeSelector: modifying this. """ - # pylint: disable=useless-return - def app_mode_for_intent(self, intent: AppIntent) -> type[AppMode]: """Given an AppIntent, return the AppMode that should handle it. diff --git a/src/assets/ba_data/python/babase/_asyncio.py b/src/assets/ba_data/python/babase/_asyncio.py index 591bfae3..0ae6b2bb 100644 --- a/src/assets/ba_data/python/babase/_asyncio.py +++ b/src/assets/ba_data/python/babase/_asyncio.py @@ -42,7 +42,7 @@ def setup_asyncio() -> asyncio.AbstractEventLoop: except RuntimeError: pass - global _asyncio_event_loop # pylint: disable=invalid-name + global _asyncio_event_loop _asyncio_event_loop = asyncio.new_event_loop() _asyncio_event_loop.set_default_executor(babase.app.threadpool) @@ -72,7 +72,7 @@ def setup_asyncio() -> asyncio.AbstractEventLoop: warn_time, ) - global _asyncio_timer # pylint: disable=invalid-name + global _asyncio_timer _asyncio_timer = _babase.AppTimer(1.0 / 30.0, run_cycle, repeat=True) if bool(False): diff --git a/src/assets/ba_data/python/babase/_general.py b/src/assets/ba_data/python/babase/_general.py index d98485c5..bc3ec1c3 100644 --- a/src/assets/ba_data/python/babase/_general.py +++ b/src/assets/ba_data/python/babase/_general.py @@ -12,7 +12,6 @@ from typing import TYPE_CHECKING, TypeVar, Protocol, NewType from efro.terminal import Clr import _babase from babase._error import print_error, print_exception -from babase._mgen.enums import TimeType if TYPE_CHECKING: from typing import Any @@ -322,6 +321,7 @@ def verify_object_death(obj: object) -> None: ref = weakref.ref(obj) except Exception: print_exception('Unable to create weak-ref in verify_object_death') + return # Use a slight range for our checks so they don't all land at once # if we queue a lot of them. diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index be97fbb9..c4ab608d 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21048 +TARGET_BALLISTICA_BUILD = 21049 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/python/methods/python_methods_app.cc b/src/ballistica/base/python/methods/python_methods_app.cc index af19b44f..f38af184 100644 --- a/src/ballistica/base/python/methods/python_methods_app.cc +++ b/src/ballistica/base/python/methods/python_methods_app.cc @@ -368,8 +368,8 @@ static PyMethodDef PyAppTimerDef = { "##### Examples\n" "Print some stuff through time:\n" ">>> babase.screenmessage('hello from now!')\n" - ">>> babase.apptimer(1.0, ba.Call(ba.screenmessage, 'hello from the " - "future!'))\n" + ">>> babase.apptimer(1.0, ba.Call(ba.screenmessage,\n" + " 'hello from the future!'))\n" ">>> babase.apptimer(2.0, ba.Call(ba.screenmessage,\n" "... 'hello from the future 2!'))\n", }; diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 3495872f..357cefe2 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21048; +const int kEngineBuildNumber = 21049; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/meta/babasemeta/pyembed/binding_base.py b/src/meta/babasemeta/pyembed/binding_base.py index 8af68834..8c4fa6c3 100644 --- a/src/meta/babasemeta/pyembed/binding_base.py +++ b/src/meta/babasemeta/pyembed/binding_base.py @@ -4,7 +4,11 @@ # Run make update to update the project after editing this.. # pylint: disable=missing-module-docstring, line-too-long from __future__ import annotations + +# noinspection PyProtectedMember from babase._mgen import enums + +# noinspection PyProtectedMember from babase import ( _language, _apputils, diff --git a/src/meta/babasemeta/pyembed/binding_base_app.py b/src/meta/babasemeta/pyembed/binding_base_app.py index 40fa0966..e872efa8 100644 --- a/src/meta/babasemeta/pyembed/binding_base_app.py +++ b/src/meta/babasemeta/pyembed/binding_base_app.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 babase diff --git a/tools/batools/dummymodule.py b/tools/batools/dummymodule.py index 1b080138..9992f073 100755 --- a/tools/batools/dummymodule.py +++ b/tools/batools/dummymodule.py @@ -176,6 +176,12 @@ def _writefuncs( if is_classmethod: defslines = f'{indstr}@classmethod\n{defslines}' + if funcname == 'quit': + defslines = ( + f'{indstr}# noinspection PyShadowingBuiltins\n' + f'{defslines}' + ) + # Types can be strings for forward-declaration cases. if (returns[0] == "'" and returns[-1] == "'") or ( returns[0] == '"' and returns[-1] == '"' @@ -788,7 +794,7 @@ class Generator: else 'TYPE_CHECKING, TypeVar' ) typing_imports_tc = ( - 'Any, Callable, Literal' + 'Any, Callable' if self.mname == '_babase' else 'Any, Callable, Literal, Sequence' if self.mname == '_bascenev1' @@ -799,7 +805,7 @@ class Generator: tc_import_lines_extra = '' if self.mname == '_babase': tc_import_lines_extra += ( - ' from babase._app import App\n import babase\n' + ' from babase import App\n import babase\n' ) elif self.mname == '_bascenev1': tc_import_lines_extra += ' import babase\n import bascenev1\n' diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index bf4540d7..6cd302a9 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -621,12 +621,19 @@ def _apply_pylint_run_to_cache( 'binascii', } + # Ignore generated dummy-modules (we don't directly check those anymore + # so they'll be listed as external). + assert os.path.isdir('build/dummymodules') + for fname in os.listdir('build/dummymodules'): + if fname.endswith('.py'): + ignored_untracked_deps.add(fname.removesuffix('.py')) + # Ignore some specific untracked deps; complain about any others. untracked_deps = set( dep for dep in untracked_deps if dep not in ignored_untracked_deps - and not dep.startswith('baplusmeta') + # and not dep.startswith('baplusmeta') ) if untracked_deps: raise CleanError(