From 37588433bc6e15595bc167a46407bbc0d27611dc Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Feb 2024 11:01:57 -0800 Subject: [PATCH] langs and misc library work --- .efrocachemap | 92 +++++++++---------- Makefile | 5 +- src/assets/ba_data/python/babase/_meta.py | 6 +- tests/test_efro/test_message.py | 60 +++++-------- tools/bacommon/bacloud.py | 12 +-- tools/bacommon/net.py | 6 +- tools/bacommon/servermanager.py | 6 +- tools/batools/build.py | 6 +- tools/efro/call.py | 105 ++++++++-------------- tools/efro/dataclassio/__init__.py | 25 ++++-- tools/efro/dataclassio/_api.py | 40 +++------ tools/efro/dataclassio/_base.py | 15 ++-- tools/efro/dataclassio/_outputter.py | 11 ++- tools/efro/debug.py | 8 +- tools/efro/log.py | 16 ++-- tools/efro/message/_protocol.py | 6 +- tools/efro/message/_receiver.py | 13 +-- tools/efro/message/_sender.py | 24 ++--- tools/efro/terminal.py | 4 +- tools/efro/util.py | 3 +- tools/efrotools/__init__.py | 6 +- tools/efrotools/pcommand.py | 8 +- tools/efrotools/sync.py | 1 - tools/efrotools/toolconfig.py | 1 - 24 files changed, 203 insertions(+), 276 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index f8c75782..9f55a5f5 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -421,7 +421,7 @@ "build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26", "build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8", "build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55", - "build/assets/ba_data/data/langdata.json": "750e45f2f19a94a44703e3d31b9a8e96", + "build/assets/ba_data/data/langdata.json": "831b83240126d0a851104f4148712ed1", "build/assets/ba_data/data/languages/arabic.json": "0db32e21b6d5337ccca478381744aa88", "build/assets/ba_data/data/languages/belarussian.json": "a112dfca3e188387516788bd8229c5b0", "build/assets/ba_data/data/languages/chinese.json": "1360ffde06828b63ce4fe956c3c3cd1d", @@ -456,7 +456,7 @@ "build/assets/ba_data/data/languages/thai.json": "9c425b420f0488a7f883da98947657ad", "build/assets/ba_data/data/languages/turkish.json": "2be25c89ca754341f27750e0d595f31e", "build/assets/ba_data/data/languages/ukrainian.json": "b54a38e93deebafa5706ba2d1f626892", - "build/assets/ba_data/data/languages/venetian.json": "8e9714d98a85e428ce3543fc49188a46", + "build/assets/ba_data/data/languages/venetian.json": "f896fc3df13a42f1bef8813ca80b1a09", "build/assets/ba_data/data/languages/vietnamese.json": "921cd1e50f60fe3e101f246e172750ba", "build/assets/ba_data/data/maps/big_g.json": "1dd301d490643088a435ce75df971054", "build/assets/ba_data/data/maps/bridgit.json": "6aea74805f4880cc11237c5734a24422", @@ -4060,50 +4060,50 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "7169141b846e3c15160f3405bd1ed2ce", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "04869210f06ff8c00fb6d68a69f6b335", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e28eac17f30edddc35c483fbc4e69fc5", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "342aee2d1f2965caed811a72888cc7f1", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "c091240edeeeac378ffe86ce1421decc", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "c959d3661ea83a2f9920da6d6d355fd9", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "9015fb2718d6fc5a9a9bd95b0086bde6", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "dfcd11db04c0071b7e5032673c2dad43", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "8a0ad295f62fc9cfa4a71d30038b0c20", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "21f2f9aecbd0c60b8e125f206ebd44c2", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "df5d59cf4b6da427b3e2bb4d1136cf32", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "72f5ab8cd24ce31b8bbfe08ce691bf7b", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "11280b6cbec7a21574f0e8e29c379bea", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "766b8ad86046a92fa5fa25a0a7ad88ae", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "10ac2e99587552edfc3eb089ea69ede4", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8cd63147b79d8866af817d01dcc8f5eb", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "061de20725a847ac6ed327d8c2e5b905", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "6556a6e96f2a360a4006f2c2b7a5a1f1", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "1324063eeaeda2c72f7e133984fa838b", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "3c6b96c3a63fc53819425f8872264aa8", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "8709ad96140d71760c2f493ee8bd7c43", - "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "ee829cd5488e9750570dc6f602d65589", - "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "8709ad96140d71760c2f493ee8bd7c43", - "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "ee829cd5488e9750570dc6f602d65589", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "35fe69d96c154b97b534711dae9d8d3a", - "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "2db876e543b3e93128ec421ea5cbb011", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "35fe69d96c154b97b534711dae9d8d3a", - "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "2db876e543b3e93128ec421ea5cbb011", - "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "417ea0f30d203d5de0e235550fcd7ab8", - "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "72d071e977c88454d0623c4a9fb34361", - "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "417ea0f30d203d5de0e235550fcd7ab8", - "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "72d071e977c88454d0623c4a9fb34361", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "de1b228d95c47a7c296a853778715326", - "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "79117cbfdf695298e1d9ae997d990c4d", - "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "984f0990a8e4cca29a382d70e51cc051", - "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "79117cbfdf695298e1d9ae997d990c4d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "810dd57e398827fb3abc488a4185a0b3", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c10f8fb6e748f6244753adef81ef5ed4", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "d30f36c9c925e52e94ef39afc8b0a35e", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "88431c1a6372b951ce85c2c73bc7f8c5", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "928e9fd64e81de0d43e433a4474826cb", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "ae0ce0dd3541770cb7bd93997aca3e04", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "0de083bc720affcbab4fbf0c121a84fe", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "299be2aa45e5d943b56828f065911172", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "d5a8312cd9cf65f32ca2a7c4a2063c03", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "aecb00e9044fa677583e1036fa7875d8", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "eca7f9ab892edfa7423a9d4a6f89e571", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "99647f48362f84112d23a9bc89eaa983", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "31e21a64d77fc0834832b633a26d986b", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "7c12b4078c3af6e627a4051b1c1d8370", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "f7a66c48321efa4462e8eae6b72db2b2", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "08cdbeb2ca4fa8c996f3369680c4e5cd", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "f92679bab5a0d057427962869e19f057", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "d5bcd695f84dab1ab32655989d399c9e", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "c766f437ece15dae0ee971e4c2e10a2d", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "cbecc4c11b9aa4621abfdc996fecfd74", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "7af782c9d9bcf1396a15dea6f2493d70", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "2c04f3f68db3e73e4aad4c656d956c00", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "132c83ee8811828739601ac3d0599fe9", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8de942a2e1ff96c147a9500a56ca4f64", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "6bf51ccbd01937bf1b28cfffe029d857", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "c5f0d834a47852f1c240e17a6c933e0a", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "4f74b71dabd207bee732dc91c9a28dc4", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "f48ab8e4c4d05f4b2231bebf33c965f1", + "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "ee36a39fd0f524989cb68930c89c8868", + "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "dbed9145e5db116d92aa47cb9e98da39", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ee36a39fd0f524989cb68930c89c8868", + "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "dbed9145e5db116d92aa47cb9e98da39", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "dc078f11a4e93062adc7d210fd4f08fb", + "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "a74bea3380d0fb39f78ac7b7598c1a72", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "dc078f11a4e93062adc7d210fd4f08fb", + "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "a74bea3380d0fb39f78ac7b7598c1a72", + "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "b397e020f33132c4dd2280cb1222cd14", + "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "ff0cb4db976707d25bd401bce80a4882", + "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "b397e020f33132c4dd2280cb1222cd14", + "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "ff0cb4db976707d25bd401bce80a4882", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "c464accef921df1325459bdd10c59b84", + "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "0896e849885cef50bcf33ce863efa7d2", + "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "e53c808357cc0a2f0da7b870be147083", + "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "0896e849885cef50bcf33ce863efa7d2", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "e34cc55fd284e31d9ed1151c5a51bf34", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "36cb65be158a0103d81c82d8a51dc8b6", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "21f8a61745c2fec88749299f5aeeeaf9", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "d61272f101f87b140b84895e482b07f4", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "36c30bcd93d38569b9515ed17896d8de", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "841c7cd3cc96c91ecd11335a91c0c465", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "305aab4423bf510f6bf95fe0c996128f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f1066b8591d7859df76c8e976ceee2d5", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "b611c090513a21e2fe90e56582724e9d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f", diff --git a/Makefile b/Makefile index d21ab3e5..ddd594fc 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ endif # Prereq targets that should be safe to run anytime; even if project-files # are out of date. PREREQS_SAFE = .cache/checkenv $(PCOMMANDBATCHBIN) .dir-locals.el .mypy.ini \ - .pyrightconfig.json .pycheckers .pylintrc .style.yapf .clang-format \ + .pyrightconfig.json .pylintrc .style.yapf .clang-format \ ballisticakit-cmake/.clang-format .editorconfig # Prereq targets that may break if the project needs updating should go here. @@ -1216,9 +1216,6 @@ ENV_SRC = $(PCOMMAND) tools/batools/build.py .pyrightconfig.json: config/toolconfigsrc/pyrightconfig.yaml $(TOOL_CFG_SRC) @$(TOOL_CFG_INST) $< $@ -.pycheckers: config/toolconfigsrc/pycheckers $(TOOL_CFG_SRC) - @$(TOOL_CFG_INST) $< $@ - # Set this to 1 to skip environment checks. SKIP_ENV_CHECKS ?= 0 diff --git a/src/assets/ba_data/python/babase/_meta.py b/src/assets/ba_data/python/babase/_meta.py index 904e354f..6e1224d8 100644 --- a/src/assets/ba_data/python/babase/_meta.py +++ b/src/assets/ba_data/python/babase/_meta.py @@ -288,14 +288,12 @@ class DirectoryScan: ) -> None: """Scan provided path and add module entries to provided list.""" try: - # Special case: let's save some time and skip the whole 'babase' - # package since we know it doesn't contain any meta tags. fullpath = Path(path, subpath) + # Note: skipping hidden dirs (starting with '.'). entries = [ (path, Path(subpath, name)) for name in os.listdir(fullpath) - # Actually scratch that for now; trying to avoid special cases. - # if name != 'babase' + if not name.startswith('.') ] except PermissionError: # Expected sometimes. diff --git a/tests/test_efro/test_message.py b/tests/test_efro/test_message.py index 7027dfe6..be5cf589 100644 --- a/tests/test_efro/test_message.py +++ b/tests/test_efro/test_message.py @@ -149,16 +149,13 @@ class _BoundTestMessageSenderSync(BoundMessageSender): """Protocol-specific bound sender.""" @overload - def send(self, message: _TMsg1) -> _TResp1: - ... + def send(self, message: _TMsg1) -> _TResp1: ... @overload - def send(self, message: _TMsg2) -> _TResp1 | _TResp2: - ... + def send(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload - def send(self, message: _TMsg3) -> None: - ... + def send(self, message: _TMsg3) -> None: ... def send(self, message: Message) -> Response | None: """Send a message synchronously.""" @@ -188,16 +185,13 @@ class _BoundTestMessageSenderAsync(BoundMessageSender): """Protocol-specific bound sender.""" @overload - async def send_async(self, message: _TMsg1) -> _TResp1: - ... + async def send_async(self, message: _TMsg1) -> _TResp1: ... @overload - async def send_async(self, message: _TMsg2) -> _TResp1 | _TResp2: - ... + async def send_async(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload - async def send_async(self, message: _TMsg3) -> None: - ... + async def send_async(self, message: _TMsg3) -> None: ... def send_async(self, message: Message) -> Awaitable[Response | None]: """Send a message asynchronously.""" @@ -227,40 +221,32 @@ class _BoundTestMessageSenderBBoth(BoundMessageSender): """Protocol-specific bound sender.""" @overload - def send(self, message: _TMsg1) -> _TResp1: - ... + def send(self, message: _TMsg1) -> _TResp1: ... @overload - def send(self, message: _TMsg2) -> _TResp1 | _TResp2: - ... + def send(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload - def send(self, message: _TMsg3) -> None: - ... + def send(self, message: _TMsg3) -> None: ... @overload - def send(self, message: _TMsg4) -> None: - ... + def send(self, message: _TMsg4) -> None: ... def send(self, message: Message) -> Response | None: """Send a message synchronously.""" return self._sender.send(self._obj, message) @overload - async def send_async(self, message: _TMsg1) -> _TResp1: - ... + async def send_async(self, message: _TMsg1) -> _TResp1: ... @overload - async def send_async(self, message: _TMsg2) -> _TResp1 | _TResp2: - ... + async def send_async(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload - async def send_async(self, message: _TMsg3) -> None: - ... + async def send_async(self, message: _TMsg3) -> None: ... @overload - async def send_async(self, message: _TMsg4) -> None: - ... + async def send_async(self, message: _TMsg4) -> None: ... def send_async(self, message: Message) -> Awaitable[Response | None]: """Send a message asynchronously.""" @@ -338,22 +324,19 @@ class _TestSyncMessageReceiver(MessageReceiver): def handler( self, call: Callable[[Any, _TMsg1], _TResp1], - ) -> Callable[[Any, _TMsg1], _TResp1]: - ... + ) -> Callable[[Any, _TMsg1], _TResp1]: ... @overload def handler( self, call: Callable[[Any, _TMsg2], _TResp1 | _TResp2], - ) -> Callable[[Any, _TMsg2], _TResp1 | _TResp2]: - ... + ) -> Callable[[Any, _TMsg2], _TResp1 | _TResp2]: ... @overload def handler( self, call: Callable[[Any, _TMsg3], None], - ) -> Callable[[Any, _TMsg3], None]: - ... + ) -> Callable[[Any, _TMsg3], None]: ... def handler(self, call: Callable) -> Callable: """Decorator to register message handlers.""" @@ -399,22 +382,19 @@ class _TestAsyncMessageReceiver(MessageReceiver): def handler( self, call: Callable[[Any, _TMsg1], Awaitable[_TResp1]], - ) -> Callable[[Any, _TMsg1], Awaitable[_TResp1]]: - ... + ) -> Callable[[Any, _TMsg1], Awaitable[_TResp1]]: ... @overload def handler( self, call: Callable[[Any, _TMsg2], Awaitable[_TResp1 | _TResp2]], - ) -> Callable[[Any, _TMsg2], Awaitable[_TResp1 | _TResp2]]: - ... + ) -> Callable[[Any, _TMsg2], Awaitable[_TResp1 | _TResp2]]: ... @overload def handler( self, call: Callable[[Any, _TMsg3], Awaitable[None]], - ) -> Callable[[Any, _TMsg3], Awaitable[None]]: - ... + ) -> Callable[[Any, _TMsg3], Awaitable[None]]: ... def handler(self, call: Callable) -> Callable: """Decorator to register message handlers.""" diff --git a/tools/bacommon/bacloud.py b/tools/bacommon/bacloud.py index 2f41f622..15f85ee5 100644 --- a/tools/bacommon/bacloud.py +++ b/tools/bacommon/bacloud.py @@ -75,9 +75,9 @@ class ResponseData: delay_seconds: Annotated[float, IOAttrs('d', store_default=False)] = 0.0 login: Annotated[str | None, IOAttrs('l', store_default=False)] = None logout: Annotated[bool, IOAttrs('lo', store_default=False)] = False - dir_manifest: Annotated[ - str | None, IOAttrs('man', store_default=False) - ] = None + dir_manifest: Annotated[str | None, IOAttrs('man', store_default=False)] = ( + None + ) uploads: Annotated[ tuple[list[str], str, dict] | None, IOAttrs('u', store_default=False) ] = None @@ -97,9 +97,9 @@ class ResponseData: input_prompt: Annotated[ tuple[str, bool] | None, IOAttrs('inp', store_default=False) ] = None - end_message: Annotated[ - str | None, IOAttrs('em', store_default=False) - ] = None + end_message: Annotated[str | None, IOAttrs('em', store_default=False)] = ( + None + ) end_message_end: Annotated[str, IOAttrs('eme', store_default=False)] = '\n' end_command: Annotated[ tuple[str, dict] | None, IOAttrs('ec', store_default=False) diff --git a/tools/bacommon/net.py b/tools/bacommon/net.py index 2cc97df1..d07f774a 100644 --- a/tools/bacommon/net.py +++ b/tools/bacommon/net.py @@ -63,9 +63,9 @@ class PrivateHostingConfig: randomize: bool = False tutorial: bool = False custom_team_names: tuple[str, str] | None = None - custom_team_colors: tuple[ - tuple[float, float, float], tuple[float, float, float] - ] | None = None + custom_team_colors: ( + tuple[tuple[float, float, float], tuple[float, float, float]] | None + ) = None playlist: list[dict[str, Any]] | None = None exit_minutes: float = 120.0 exit_minutes_unclean: float = 180.0 diff --git a/tools/bacommon/servermanager.py b/tools/bacommon/servermanager.py index 28ca0db5..0fe8e7d8 100644 --- a/tools/bacommon/servermanager.py +++ b/tools/bacommon/servermanager.py @@ -134,9 +134,9 @@ class ServerConfig: team_names: tuple[str, str] | None = None # Team colors (teams mode only). - team_colors: tuple[ - tuple[float, float, float], tuple[float, float, float] - ] | None = None + team_colors: ( + tuple[tuple[float, float, float], tuple[float, float, float]] | None + ) = None # Whether to enable the queue where players can line up before entering # your server. Disabling this can be used as a workaround to deal with diff --git a/tools/batools/build.py b/tools/batools/build.py index 1bc59689..72caf9e6 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -52,7 +52,7 @@ PY_REQUIREMENTS = [ PyRequirement(pipname='requests', minversion=[2, 31, 0]), PyRequirement(pipname='pdoc', minversion=[14, 4, 0]), PyRequirement(pipname='PyYAML', minversion=[6, 0, 1]), - PyRequirement(pipname='black', minversion=[23, 12, 1]), + PyRequirement(pipname='black', minversion=[24, 1, 1]), PyRequirement(pipname='typing_extensions', minversion=[4, 9, 0]), PyRequirement(pipname='types-filelock', minversion=[3, 2, 7]), PyRequirement(pipname='types-requests', minversion=[2, 31, 0, 20240106]), @@ -614,7 +614,7 @@ def _get_server_config_template_yaml(projroot: str) -> str: # Ignore indented lines (our few multi-line special cases). continue - if line.startswith(']'): + if line.startswith(']') or line.startswith(')'): # Ignore closing lines (our few multi-line special cases). continue @@ -643,7 +643,7 @@ def _get_server_config_template_yaml(projroot: str) -> str: before_equal_sign = before_equal_sign.strip() vval_raw = vval_raw.strip() vname = before_equal_sign.split()[0] - assert vname.endswith(':') + assert vname.endswith(':'), f"'{vname}' does not end with ':'" vname = vname[:-1] vval: Any if vval_raw == 'field(default_factory=list)': diff --git a/tools/efro/call.py b/tools/efro/call.py index 8e811e50..933f3f0b 100644 --- a/tools/efro/call.py +++ b/tools/efro/call.py @@ -83,57 +83,46 @@ if TYPE_CHECKING: class _CallNoArgs(Generic[OutT]): """Single argument variant of call wrapper.""" - def __init__(self, _call: Callable[[], OutT]): - ... + def __init__(self, _call: Callable[[], OutT]): ... - def __call__(self) -> OutT: - ... + def __call__(self) -> OutT: ... class _Call1Arg(Generic[In1T, OutT]): """Single argument variant of call wrapper.""" - def __init__(self, _call: Callable[[In1T], OutT]): - ... + def __init__(self, _call: Callable[[In1T], OutT]): ... - def __call__(self, _arg1: In1T) -> OutT: - ... + def __call__(self, _arg1: In1T) -> OutT: ... class _Call2Args(Generic[In1T, In2T, OutT]): """Two argument variant of call wrapper""" - def __init__(self, _call: Callable[[In1T, In2T], OutT]): - ... + def __init__(self, _call: Callable[[In1T, In2T], OutT]): ... - def __call__(self, _arg1: In1T, _arg2: In2T) -> OutT: - ... + def __call__(self, _arg1: In1T, _arg2: In2T) -> OutT: ... class _Call3Args(Generic[In1T, In2T, In3T, OutT]): """Three argument variant of call wrapper""" - def __init__(self, _call: Callable[[In1T, In2T, In3T], OutT]): - ... + def __init__(self, _call: Callable[[In1T, In2T, In3T], OutT]): ... - def __call__(self, _arg1: In1T, _arg2: In2T, _arg3: In3T) -> OutT: - ... + def __call__(self, _arg1: In1T, _arg2: In2T, _arg3: In3T) -> OutT: ... class _Call4Args(Generic[In1T, In2T, In3T, In4T, OutT]): """Four argument variant of call wrapper""" - def __init__(self, _call: Callable[[In1T, In2T, In3T, In4T], OutT]): - ... + def __init__(self, _call: Callable[[In1T, In2T, In3T, In4T], OutT]): ... def __call__( self, _arg1: In1T, _arg2: In2T, _arg3: In3T, _arg4: In4T - ) -> OutT: - ... + ) -> OutT: ... class _Call5Args(Generic[In1T, In2T, In3T, In4T, In5T, OutT]): """Five argument variant of call wrapper""" def __init__( self, _call: Callable[[In1T, In2T, In3T, In4T, In5T], OutT] - ): - ... + ): ... def __call__( self, @@ -142,16 +131,14 @@ if TYPE_CHECKING: _arg3: In3T, _arg4: In4T, _arg5: In5T, - ) -> OutT: - ... + ) -> OutT: ... class _Call6Args(Generic[In1T, In2T, In3T, In4T, In5T, In6T, OutT]): """Six argument variant of call wrapper""" def __init__( self, _call: Callable[[In1T, In2T, In3T, In4T, In5T, In6T], OutT] - ): - ... + ): ... def __call__( self, @@ -161,8 +148,7 @@ if TYPE_CHECKING: _arg4: In4T, _arg5: In5T, _arg6: In6T, - ) -> OutT: - ... + ) -> OutT: ... class _Call7Args(Generic[In1T, In2T, In3T, In4T, In5T, In6T, In7T, OutT]): """Seven argument variant of call wrapper""" @@ -170,8 +156,7 @@ if TYPE_CHECKING: def __init__( self, _call: Callable[[In1T, In2T, In3T, In4T, In5T, In6T, In7T], OutT], - ): - ... + ): ... def __call__( self, @@ -182,50 +167,43 @@ if TYPE_CHECKING: _arg5: In5T, _arg6: In6T, _arg7: In7T, - ) -> OutT: - ... + ) -> OutT: ... # No arg call; no args bundled. # noinspection PyPep8Naming @overload - def Call(call: Callable[[], OutT]) -> _CallNoArgs[OutT]: - ... + def Call(call: Callable[[], OutT]) -> _CallNoArgs[OutT]: ... # 1 arg call; 1 arg bundled. # noinspection PyPep8Naming @overload - def Call(call: Callable[[In1T], OutT], arg1: In1T) -> _CallNoArgs[OutT]: - ... + def Call(call: Callable[[In1T], OutT], arg1: In1T) -> _CallNoArgs[OutT]: ... # 1 arg call; no args bundled. # noinspection PyPep8Naming @overload - def Call(call: Callable[[In1T], OutT]) -> _Call1Arg[In1T, OutT]: - ... + def Call(call: Callable[[In1T], OutT]) -> _Call1Arg[In1T, OutT]: ... # 2 arg call; 2 args bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T], OutT], arg1: In1T, arg2: In2T - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # 2 arg call; 1 arg bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T], OutT], arg1: In1T - ) -> _Call1Arg[In2T, OutT]: - ... + ) -> _Call1Arg[In2T, OutT]: ... # 2 arg call; no args bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T], OutT] - ) -> _Call2Args[In1T, In2T, OutT]: - ... + ) -> _Call2Args[In1T, In2T, OutT]: ... # 3 arg call; 3 args bundled. # noinspection PyPep8Naming @@ -235,32 +213,28 @@ if TYPE_CHECKING: arg1: In1T, arg2: In2T, arg3: In3T, - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # 3 arg call; 2 args bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T, In3T], OutT], arg1: In1T, arg2: In2T - ) -> _Call1Arg[In3T, OutT]: - ... + ) -> _Call1Arg[In3T, OutT]: ... # 3 arg call; 1 arg bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T, In3T], OutT], arg1: In1T - ) -> _Call2Args[In2T, In3T, OutT]: - ... + ) -> _Call2Args[In2T, In3T, OutT]: ... # 3 arg call; no args bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T, In3T], OutT] - ) -> _Call3Args[In1T, In2T, In3T, OutT]: - ... + ) -> _Call3Args[In1T, In2T, In3T, OutT]: ... # 4 arg call; 4 args bundled. # noinspection PyPep8Naming @@ -271,8 +245,7 @@ if TYPE_CHECKING: arg2: In2T, arg3: In3T, arg4: In4T, - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # 4 arg call; 3 args bundled. # noinspection PyPep8Naming @@ -282,8 +255,7 @@ if TYPE_CHECKING: arg1: In1T, arg2: In2T, arg3: In3T, - ) -> _Call1Arg[In4T, OutT]: - ... + ) -> _Call1Arg[In4T, OutT]: ... # 4 arg call; 2 args bundled. # noinspection PyPep8Naming @@ -292,8 +264,7 @@ if TYPE_CHECKING: call: Callable[[In1T, In2T, In3T, In4T], OutT], arg1: In1T, arg2: In2T, - ) -> _Call2Args[In3T, In4T, OutT]: - ... + ) -> _Call2Args[In3T, In4T, OutT]: ... # 4 arg call; 1 arg bundled. # noinspection PyPep8Naming @@ -301,16 +272,14 @@ if TYPE_CHECKING: def Call( call: Callable[[In1T, In2T, In3T, In4T], OutT], arg1: In1T, - ) -> _Call3Args[In2T, In3T, In4T, OutT]: - ... + ) -> _Call3Args[In2T, In3T, In4T, OutT]: ... # 4 arg call; no args bundled. # noinspection PyPep8Naming @overload def Call( call: Callable[[In1T, In2T, In3T, In4T], OutT], - ) -> _Call4Args[In1T, In2T, In3T, In4T, OutT]: - ... + ) -> _Call4Args[In1T, In2T, In3T, In4T, OutT]: ... # 5 arg call; 5 args bundled. # noinspection PyPep8Naming @@ -322,8 +291,7 @@ if TYPE_CHECKING: arg3: In3T, arg4: In4T, arg5: In5T, - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # 6 arg call; 6 args bundled. # noinspection PyPep8Naming @@ -336,8 +304,7 @@ if TYPE_CHECKING: arg4: In4T, arg5: In5T, arg6: In6T, - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # 7 arg call; 7 args bundled. # noinspection PyPep8Naming @@ -351,12 +318,10 @@ if TYPE_CHECKING: arg5: In5T, arg6: In6T, arg7: In7T, - ) -> _CallNoArgs[OutT]: - ... + ) -> _CallNoArgs[OutT]: ... # noinspection PyPep8Naming - def Call(*_args: Any, **_keywds: Any) -> Any: - ... + def Call(*_args: Any, **_keywds: Any) -> Any: ... # (Type-safe Partial) # A convenient wrapper around functools.partial which adds type-safety diff --git a/tools/efro/dataclassio/__init__.py b/tools/efro/dataclassio/__init__.py index 9c6ae98a..eae9c820 100644 --- a/tools/efro/dataclassio/__init__.py +++ b/tools/efro/dataclassio/__init__.py @@ -11,7 +11,13 @@ data formats in a nondestructive manner. from __future__ import annotations from efro.util import set_canonical_module_names -from efro.dataclassio._base import Codec, IOAttrs, IOExtendedData, IOMultiType +from efro.dataclassio._base import ( + Codec, + IOAttrs, + IOExtendedData, + IOMultiType, + EXTRA_ATTRS_ATTR, +) from efro.dataclassio._prep import ( ioprep, ioprepped, @@ -29,21 +35,22 @@ from efro.dataclassio._api import ( ) __all__ = [ - 'JsonStyle', 'Codec', + 'DataclassFieldLookup', + 'EXTRA_ATTRS_ATTR', 'IOAttrs', 'IOExtendedData', 'IOMultiType', - 'ioprep', - 'ioprepped', - 'will_ioprep', - 'is_ioprepped_dataclass', - 'DataclassFieldLookup', - 'dataclass_to_dict', - 'dataclass_to_json', + 'JsonStyle', 'dataclass_from_dict', 'dataclass_from_json', + 'dataclass_to_dict', + 'dataclass_to_json', 'dataclass_validate', + 'ioprep', + 'ioprepped', + 'is_ioprepped_dataclass', + 'will_ioprep', ] # Have these things present themselves cleanly as 'thismodule.SomeClass' diff --git a/tools/efro/dataclassio/_api.py b/tools/efro/dataclassio/_api.py index 2fa308fa..0bd5f895 100644 --- a/tools/efro/dataclassio/_api.py +++ b/tools/efro/dataclassio/_api.py @@ -91,28 +91,6 @@ def dataclass_to_json( return json.dumps(jdict, separators=(',', ':'), sort_keys=sort_keys) -# @overload -# def dataclass_from_dict( -# cls: type[T], -# values: dict, -# codec: Codec = Codec.JSON, -# coerce_to_float: bool = True, -# allow_unknown_attrs: bool = True, -# discard_unknown_attrs: bool = False, -# ) -> T: ... - - -# @overload -# def dataclass_from_dict( -# cls: IOTypeMap, -# values: dict, -# codec: Codec = Codec.JSON, -# coerce_to_float: bool = True, -# allow_unknown_attrs: bool = True, -# discard_unknown_attrs: bool = False, -# ) -> Any: ... - - def dataclass_from_dict( cls: type[T], values: dict, @@ -125,24 +103,26 @@ def dataclass_from_dict( The dict must be formatted to match the specified codec (generally json-friendly object types). This means that sequence values such as - tuples or sets should be passed as lists, enums should be passed as their - associated values, nested dataclasses should be passed as dicts, etc. + tuples or sets should be passed as lists, enums should be passed as + their associated values, nested dataclasses should be passed as dicts, + etc. All values are checked to ensure their types/values are valid. Data for attributes of type Any will be checked to ensure they match types supported directly by json. This does not include types such as tuples which are implicitly translated by Python's json module - (as this would break the ability to do a lossless round-trip with data). + (as this would break the ability to do a lossless round-trip with + data). If coerce_to_float is True, int values passed for float typed fields will be converted to float values. Otherwise, a TypeError is raised. - If allow_unknown_attrs is False, AttributeErrors will be raised for - attributes present in the dict but not on the data class. Otherwise, they - will be preserved as part of the instance and included if it is - exported back to a dict, unless discard_unknown_attrs is True, in which - case they will simply be discarded. + If `allow_unknown_attrs` is False, AttributeErrors will be raised for + attributes present in the dict but not on the data class. Otherwise, + they will be preserved as part of the instance and included if it is + exported back to a dict, unless `discard_unknown_attrs` is True, in + which case they will simply be discarded. """ val = _Inputter( cls, diff --git a/tools/efro/dataclassio/_base.py b/tools/efro/dataclassio/_base.py index eda3243e..d2edc2f8 100644 --- a/tools/efro/dataclassio/_base.py +++ b/tools/efro/dataclassio/_base.py @@ -19,8 +19,9 @@ if TYPE_CHECKING: # Types which we can pass through as-is. SIMPLE_TYPES = {int, bool, str, float, type(None)} -# Attr name for dict of extra attributes included on dataclass instances. -# Note that this is only added if extra attributes are present. +# Attr name for dict of extra attributes included on dataclass +# instances. Note that this is only added if extra attributes are +# present. EXTRA_ATTRS_ATTR = '_DCIOEXATTRS' @@ -68,12 +69,12 @@ class IOMultiType(Generic[EnumT]): """A base class for types that can map to multiple dataclass types. This enables usage of high level base classes (for example - a 'Message' type) in dataclasses, with dataclassio automatically - serializing & deserializing subclass instances based on their - type. + a 'Message' type) in annotations, with dataclassio automatically + serializing & deserializing dataclass subclasses based on their + type ('MessagePing', 'MessageChat', etc.) Standard usage involves creating a class which inherits from this - one that acts as a 'registry', and then creating dataclass classes + one which acts as a 'registry', and then creating dataclass classes inheriting from that registry class. Dataclassio will then do the right thing when that registry class is used in type annotations. @@ -82,7 +83,7 @@ class IOMultiType(Generic[EnumT]): # Dataclasses inheriting from an IOMultiType will store a type-id # with this key in their serialized data. This value can be - # overridden in IOMultiType subclasses in case of conflicts. + # overridden in IOMultiType subclasses as desired. ID_STORAGE_NAME = '_dciotype' @classmethod diff --git a/tools/efro/dataclassio/_outputter.py b/tools/efro/dataclassio/_outputter.py index 198ad93e..216b11d9 100644 --- a/tools/efro/dataclassio/_outputter.py +++ b/tools/efro/dataclassio/_outputter.py @@ -72,6 +72,7 @@ class _Outputter: def _process_dataclass(self, cls: type, obj: Any, fieldpath: str) -> Any: # pylint: disable=too-many-locals # pylint: disable=too-many-branches + # pylint: disable=too-many-statements prep = PrepSession(explicit=False).prep_dataclass( type(obj), recursion_level=0 ) @@ -146,8 +147,16 @@ class _Outputter: # If this obj inherits from multi-type, store its type id. if isinstance(obj, IOMultiType): type_id = obj.get_type_id() - # Sanity checks; make sure looking up this id gets us this type. + + # Sanity checks; make sure looking up this id gets us this + # type. assert isinstance(type_id.value, str) + if obj.get_type(type_id) is not type(obj): + raise RuntimeError( + f'dataclassio: object of type {type(obj)}' + f' gives type-id {type_id} but that id gives type' + f' {obj.get_type(type_id)}. Something is out of sync.' + ) assert obj.get_type(type_id) is type(obj) if self._create: assert out is not None diff --git a/tools/efro/debug.py b/tools/efro/debug.py index 438a84e6..1f9b8b90 100644 --- a/tools/efro/debug.py +++ b/tools/efro/debug.py @@ -278,9 +278,7 @@ def _desc(obj: Any) -> str: tpss = ( f', contains [{tpsj}, ...]' if len(obj) > 3 - else f', contains [{tpsj}]' - if tps - else '' + else f', contains [{tpsj}]' if tps else '' ) extra = f' (len {len(obj)}{tpss})' elif isinstance(obj, dict): @@ -299,9 +297,7 @@ def _desc(obj: Any) -> str: pairss = ( f', contains {{{pairsj}, ...}}' if len(obj) > 3 - else f', contains {{{pairsj}}}' - if pairs - else '' + else f', contains {{{pairsj}}}' if pairs else '' ) extra = f' (len {len(obj)}{pairss})' if extra is None: diff --git a/tools/efro/log.py b/tools/efro/log.py index 680d94e8..e33e10a1 100644 --- a/tools/efro/log.py +++ b/tools/efro/log.py @@ -92,9 +92,9 @@ class LogEntry: # incorporated into custom log processing. To populate this, our # LogHandler class looks for a 'labels' dict passed in the optional # 'extra' dict arg to standard Python log calls. - labels: Annotated[ - dict[str, str], IOAttrs('la', store_default=False) - ] = field(default_factory=dict) + labels: Annotated[dict[str, str], IOAttrs('la', store_default=False)] = ( + field(default_factory=dict) + ) @ioprepped @@ -483,11 +483,11 @@ class LogHandler(logging.Handler): # after a short bit if we never get a newline. ship_task = self._file_chunk_ship_task[name] if ship_task is None: - self._file_chunk_ship_task[ - name - ] = self._event_loop.create_task( - self._ship_chunks_task(name), - name='log ship file chunks', + self._file_chunk_ship_task[name] = ( + self._event_loop.create_task( + self._ship_chunks_task(name), + name='log ship file chunks', + ) ) except Exception: diff --git a/tools/efro/message/_protocol.py b/tools/efro/message/_protocol.py index 8daa8d88..57dd80a2 100644 --- a/tools/efro/message/_protocol.py +++ b/tools/efro/message/_protocol.py @@ -499,8 +499,7 @@ class MessageProtocol: f' @overload\n' f' {pfx}def send{sfx}(self,' f' message: {msgtypevar})' - f' -> {rtypevar}:\n' - f' ...\n' + f' -> {rtypevar}: ...\n' ) rtypevar = 'Response | None' if async_pass: @@ -607,8 +606,7 @@ class MessageProtocol: f' call: Callable[[Any, {msgtypevar}], ' f'{rtypevar}],\n' f' )' - f' -> Callable[[Any, {msgtypevar}], {rtypevar}]:\n' - f' ...\n' + f' -> Callable[[Any, {msgtypevar}], {rtypevar}]: ...\n' ) out += ( '\n' diff --git a/tools/efro/message/_receiver.py b/tools/efro/message/_receiver.py index f8c38783..8ef6e8b0 100644 --- a/tools/efro/message/_receiver.py +++ b/tools/efro/message/_receiver.py @@ -55,12 +55,13 @@ class MessageReceiver: def __init__(self, protocol: MessageProtocol) -> None: self.protocol = protocol self._handlers: dict[type[Message], Callable] = {} - self._decode_filter_call: Callable[ - [Any, dict, Message], None - ] | None = None - self._encode_filter_call: Callable[ - [Any, Message | None, Response | SysResponse, dict], None - ] | None = None + self._decode_filter_call: ( + Callable[[Any, dict, Message], None] | None + ) = None + self._encode_filter_call: ( + Callable[[Any, Message | None, Response | SysResponse, dict], None] + | None + ) = None # noinspection PyProtectedMember def register_handler( diff --git a/tools/efro/message/_sender.py b/tools/efro/message/_sender.py index c1f9d00c..b7e18755 100644 --- a/tools/efro/message/_sender.py +++ b/tools/efro/message/_sender.py @@ -41,18 +41,18 @@ class MessageSender: def __init__(self, protocol: MessageProtocol) -> None: self.protocol = protocol self._send_raw_message_call: Callable[[Any, str], str] | None = None - self._send_async_raw_message_call: Callable[ - [Any, str], Awaitable[str] - ] | None = None - self._send_async_raw_message_ex_call: Callable[ - [Any, str, Message], Awaitable[str] - ] | None = None - self._encode_filter_call: Callable[ - [Any, Message, dict], None - ] | None = None - self._decode_filter_call: Callable[ - [Any, Message, dict, Response | SysResponse], None - ] | None = None + self._send_async_raw_message_call: ( + Callable[[Any, str], Awaitable[str]] | None + ) = None + self._send_async_raw_message_ex_call: ( + Callable[[Any, str, Message], Awaitable[str]] | None + ) = None + self._encode_filter_call: ( + Callable[[Any, Message, dict], None] | None + ) = None + self._decode_filter_call: ( + Callable[[Any, Message, dict, Response | SysResponse], None] | None + ) = None self._peer_desc_call: Callable[[Any], str] | None = None def send_method( diff --git a/tools/efro/terminal.py b/tools/efro/terminal.py index 7b84c658..6d8cd745 100644 --- a/tools/efro/terminal.py +++ b/tools/efro/terminal.py @@ -317,8 +317,6 @@ _envval = os.environ.get('EFRO_TERMCOLORS') color_enabled: bool = ( True if _envval == '1' - else False - if _envval == '0' - else _default_color_enabled() + else False if _envval == '0' else _default_color_enabled() ) Clr: type[ClrBase] = ClrAlways if color_enabled else ClrNever diff --git a/tools/efro/util.py b/tools/efro/util.py index f5815429..5fc5b3ec 100644 --- a/tools/efro/util.py +++ b/tools/efro/util.py @@ -459,8 +459,7 @@ if TYPE_CHECKING: class ValueDispatcherMethod(Generic[ValT, RetT]): """Used by the valuedispatchmethod decorator.""" - def __call__(self, value: ValT) -> RetT: - ... + def __call__(self, value: ValT) -> RetT: ... def register( self, value: ValT diff --git a/tools/efrotools/__init__.py b/tools/efrotools/__init__.py index 1c3bbd45..33cc1aa5 100644 --- a/tools/efrotools/__init__.py +++ b/tools/efrotools/__init__.py @@ -105,13 +105,11 @@ def extract_flag(args: list[str], name: str) -> bool: @overload def extract_arg( args: list[str], name: str, required: Literal[False] = False -) -> str | None: - ... +) -> str | None: ... @overload -def extract_arg(args: list[str], name: str, required: Literal[True]) -> str: - ... +def extract_arg(args: list[str], name: str, required: Literal[True]) -> str: ... def extract_arg( diff --git a/tools/efrotools/pcommand.py b/tools/efrotools/pcommand.py index 43fb1be8..ace1aab8 100644 --- a/tools/efrotools/pcommand.py +++ b/tools/efrotools/pcommand.py @@ -120,9 +120,11 @@ def clientprint( assert _g_thread_local_storage is not None print( *args, - file=_g_thread_local_storage.stderr - if stderr - else _g_thread_local_storage.stdout, + file=( + _g_thread_local_storage.stderr + if stderr + else _g_thread_local_storage.stdout + ), end=end, ) else: diff --git a/tools/efrotools/sync.py b/tools/efrotools/sync.py index 28e2ecc6..71cf7ddd 100644 --- a/tools/efrotools/sync.py +++ b/tools/efrotools/sync.py @@ -39,7 +39,6 @@ def _valid_filename(fname: str) -> bool: 'requirements.txt', 'pylintrc', 'clang-format', - 'pycheckers', 'style.yapf', 'test_task_bin', '.editorconfig', diff --git a/tools/efrotools/toolconfig.py b/tools/efrotools/toolconfig.py index 82690847..bb993a5c 100644 --- a/tools/efrotools/toolconfig.py +++ b/tools/efrotools/toolconfig.py @@ -47,7 +47,6 @@ def install_tool_config(projroot: Path, src: Path, dst: Path) -> None: comment = ';;' elif dst.name in [ '.mypy.ini', - '.pycheckers', '.pylintrc', '.style.yapf', '.clang-format',