From 25c3f2ee01a1f630009487fa199a5d82e31b875f Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 10 Oct 2022 16:33:12 -0700 Subject: [PATCH] removing need for python formatting in tests (fix win ci tasks) --- .efrocachemap | 56 +++++------ .idea/dictionaries/ericf.xml | 1 + CHANGELOG.md | 2 +- assets/src/ba_data/python/ba/_bootstrap.py | 2 +- .../.idea/dictionaries/ericf.xml | 1 + config/toolconfigsrc/dir-locals.el | 6 +- src/ballistica/ballistica.cc | 2 +- tests/test_efro/test_message.py | 93 ++++++++----------- tools/efro/message/_protocol.py | 39 ++++---- tools/efrotools/code.py | 1 + tools/efrotools/pcommand.py | 10 ++ 11 files changed, 106 insertions(+), 107 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 34cba2d6..f2d000a2 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4003,26 +4003,26 @@ "assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e", "assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/bf/79/93a020d1ffda39d0d01ea8e0479a", - "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7a/15/d3208b2f2a3eef6fd99e1f8ff33a", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/68/c7/d03c7b9e2b27080abf8dab81c353", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/85/e8/5ac6499c33d01935df05b28d6e35", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/eb/26/456b39bca29b1f9409467be6cbc9", - "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/bd/e6e7e45ccb7a4d4569e1a574ccb5", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f7/56/994e3e2dd054c838db5fa60089b1", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/62/ca/fb78c9774ea0d670854fd7c3b68f", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/79/b9/0886caeb0bcceaeefde3009b3260", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/04/60/a49352dea8100f7f979c42428566", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/49/b3/ed8416d34b63ad225d0199c70c40", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f9/69/1f530c56a627c8d36a1c14bfc023", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ee/a0/8f3610554e441a9f55e9a0b5a20a", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7e/5d/28fc24d104d3f0a8f98e6f830062", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fd/4b/348eebb51a0e01a740fe1cac1b0c", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/44/03/fc0726f576a224b811eb4767c08d", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0b/b3/57b75dfabbb22802aaca7eec164e", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/1f/63/a05a78b98665377e24e9f8db8bf1", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b2/55/ba110ac1a33d84a1458315d4b4fe", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/c1/32/730d6c42e157f214083d5dcdbea2", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c0/b2/ff130457d068b900d961e2354adc", + "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/3e/6f/e5eb8e0646c8a56d81a744b83033", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bc/a0/8801adcaae0ebf8e065e50df88e5", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/60/0d/a08147b59d213ef1a61b6a393997", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c0/16/798fbe8f0e563c2a1158f612df18", + "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b0/f6/6db11e5da130e85b59c1e99f34d2", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/95/30cb68910669c012bf5f3e0f5d8d", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9d/53/124cd00020647d0ea73114368d9f", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e4/a0/14debf6938db7d2db3e6a66dd51a", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/af/4d/9d01c0b54f17152439ff229585a8", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d3/ef/35e69f1dc7e0d2ec40814169ee16", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/46/77/675fc277cb7d0b4362b4ad002dbd", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/75/de/899f4b4c7864a775a918735d2050", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ac/31/75bab23c1617aaf9c07c428ee477", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/18/0c/ff933dc5901512c7bcd8fc9d0c2a", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5d/ad/992a5b10cfd2fb13ce402d64e672", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/3f/3e/d7ffee3c48c5e7e61432274c303c", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d2/aa/ac8b35f42058ce4accd33f689366", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/f7/d9/037846d00c1491e4d09609cbbec6", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ae/47/d79b5b8c9168944641514072c56c", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a0/2a/df32b0c34525af7de212e9a2cf30", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/28/f103463730f785ba4fe6a91f8943", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/29/4a/0df587009671edf52d6939c8f966", @@ -4039,14 +4039,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/27/b6/676cee2d1996ab592e1006ba4721", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b1/fe/bf79be22fc78040b28b60aa2a8e3", "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/37/3e/689be0ffce83ac46775c5dec6446", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/76/0a/1fbf3abebda99e8bddc30c60a776", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/cb/ce/496131ca3fec3ebd3cf7e8356465", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/2f/02/99c9b9887c50a45007a3825c923a", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/11/10/4e32246cf49a018b34012d167a31", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/02/62/edbc7740c386330cd72be2f7b50a", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/1e/d8/bb3d3b9c170b1696709ba53ef356", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/61/12/5ff38e6e4b2d3dcc1db55db9cf06", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/eb/92/0c028cdd75d65b2f8c37f6fbc1da", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/ff/e0/707a7f27737a95cd484a8105cb1e", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/22/40/9c60cea175b1685b6ceb49825753", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/b7/2a/6bf91a3cce672678d4313535e5f8", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/31/97/77ee5fbf99340b8a5368b691fffb", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/de/9c/7232b3307214ae9b18c7c7673afa", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/ec/e8/a98b515b312ab875ee58464050e8", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/21/f0/41a934523b6b34ba5f9e9cee96c6", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/43/97/158153da90bd41bba18cd245a6be", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/c0/32/b7907e3859a5c5013a3d97b6b523", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/2d/4f/f4fe67827f36cd59cd5193333a02", "src/ballistica/generated/python_embedded/bootstrap_monolithic.inc": "https://files.ballistica.net/cache/ba1/ef/c1/aa5f1aa10af89f5c0b1e616355fd" diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 78ae599b..e82d8857 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -206,6 +206,7 @@ bametainternal barcolor barebones + bargs baseaddr baseh baseimps diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a0c9b15..3d517798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.11 (build 20897, api 7, 2022-10-09) +### 1.7.11 (build 20899, api 7, 2022-10-10) - Switched our Python autoformatting from yapf to black. The yapf project seems to be mostly dead whereas black seems to be thriving. The final straw was yapf not supporting the `match` statement in Python 3.10. ### 1.7.10 (build 20895, api 7, 2022-10-09) diff --git a/assets/src/ba_data/python/ba/_bootstrap.py b/assets/src/ba_data/python/ba/_bootstrap.py index 6c84aacb..e3238519 100644 --- a/assets/src/ba_data/python/ba/_bootstrap.py +++ b/assets/src/ba_data/python/ba/_bootstrap.py @@ -47,7 +47,7 @@ def bootstrap() -> None: # Give a soft warning if we're being used with a different binary # version than we expect. - expected_build = 20897 + expected_build = 20899 running_build: int = env['build_number'] if running_build != expected_build: print( diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index 09c7f8a9..dd33b099 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -106,6 +106,7 @@ bameta bametainternal barebones + bargs baseaddr baseimps basetype diff --git a/config/toolconfigsrc/dir-locals.el b/config/toolconfigsrc/dir-locals.el index 2afaa57d..81c39f95 100644 --- a/config/toolconfigsrc/dir-locals.el +++ b/config/toolconfigsrc/dir-locals.el @@ -3,8 +3,12 @@ ;;; Turn flycheck mode on for our c++ stuff and tell jedi where to look for our python stuff. ((c++-mode (eval . (flycheck-mode))) + + (python-mode (jedi:server-args . ("--sys-path" "__EFRO_PROJECT_ROOT__/tools" - "--sys-path" "__EFRO_PROJECT_ROOT__/assets/src/ba_data/python"))) + "--sys-path" "__EFRO_PROJECT_ROOT__/assets/src/ba_data/python")) + (python-black-extra-args . __PYTHON_BLACK_EXTRA_ARGS__)) + ;; Shorter name in projectile status bar to save valuable space. (nil . ((projectile-project-name . "__EFRO_PROJECT_SHORTNAME__"))) diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 20df7450..4838d50d 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -32,7 +32,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20897; +const int kAppBuildNumber = 20899; const char* kAppVersion = "1.7.11"; // Our standalone globals. diff --git a/tests/test_efro/test_message.py b/tests/test_efro/test_message.py index acb0baca..9916bf3a 100644 --- a/tests/test_efro/test_message.py +++ b/tests/test_efro/test_message.py @@ -14,7 +14,6 @@ from dataclasses import dataclass from typing_extensions import assert_type import pytest -from efrotools.code import format_python_str from efro.error import CleanError, RemoteError, CommunicationError from efro.dataclassio import ioprepped from efro.message import ( @@ -506,14 +505,12 @@ def test_sender_module_single_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL_SINGLE.do_create_sender_module( - 'TestMessageSenderSingle', - protocol_create_code='protocol = TEST_PROTOCOL_SINGLE', - enable_sync_sends=True, - enable_async_sends=False, - private=True, - ) + smod = TEST_PROTOCOL_SINGLE.do_create_sender_module( + 'TestMessageSenderSingle', + protocol_create_code='protocol = TEST_PROTOCOL_SINGLE', + enable_sync_sends=True, + enable_async_sends=False, + private=True, ) # Clip everything up to our first class declaration. @@ -545,14 +542,12 @@ def test_sender_module_sync_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL.do_create_sender_module( - 'TestMessageSenderSync', - protocol_create_code='protocol = TEST_PROTOCOL', - enable_sync_sends=True, - enable_async_sends=False, - private=True, - ) + smod = TEST_PROTOCOL.do_create_sender_module( + 'TestMessageSenderSync', + protocol_create_code='protocol = TEST_PROTOCOL', + enable_sync_sends=True, + enable_async_sends=False, + private=True, ) # Clip everything up to our first class declaration. @@ -584,14 +579,12 @@ def test_sender_module_async_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL.do_create_sender_module( - 'TestMessageSenderAsync', - protocol_create_code='protocol = TEST_PROTOCOL', - enable_sync_sends=False, - enable_async_sends=True, - private=True, - ) + smod = TEST_PROTOCOL.do_create_sender_module( + 'TestMessageSenderAsync', + protocol_create_code='protocol = TEST_PROTOCOL', + enable_sync_sends=False, + enable_async_sends=True, + private=True, ) # Clip everything up to our first class declaration. @@ -623,14 +616,12 @@ def test_sender_module_both_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL_EVOLVED.do_create_sender_module( - 'TestMessageSenderBBoth', - protocol_create_code='protocol = TEST_PROTOCOL_EVOLVED', - enable_sync_sends=True, - enable_async_sends=True, - private=True, - ) + smod = TEST_PROTOCOL_EVOLVED.do_create_sender_module( + 'TestMessageSenderBBoth', + protocol_create_code='protocol = TEST_PROTOCOL_EVOLVED', + enable_sync_sends=True, + enable_async_sends=True, + private=True, ) # Clip everything up to our first class declaration. @@ -662,13 +653,11 @@ def test_receiver_module_single_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL_SINGLE.do_create_receiver_module( - 'TestSingleMessageReceiver', - 'protocol = TEST_PROTOCOL_SINGLE', - is_async=False, - private=True, - ) + smod = TEST_PROTOCOL_SINGLE.do_create_receiver_module( + 'TestSingleMessageReceiver', + 'protocol = TEST_PROTOCOL_SINGLE', + is_async=False, + private=True, ) # Clip everything up to our first class declaration. @@ -702,13 +691,11 @@ def test_receiver_module_sync_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL.do_create_receiver_module( - 'TestSyncMessageReceiver', - 'protocol = TEST_PROTOCOL', - is_async=False, - private=True, - ) + smod = TEST_PROTOCOL.do_create_receiver_module( + 'TestSyncMessageReceiver', + 'protocol = TEST_PROTOCOL', + is_async=False, + private=True, ) # Clip everything up to our first class declaration. @@ -740,13 +727,11 @@ def test_receiver_module_async_emb() -> None: # here, but it requires us to pass code which imports this test module # to get at the protocol, and that currently fails in our static mypy # tests. - smod = format_python_str( - TEST_PROTOCOL.do_create_receiver_module( - 'TestAsyncMessageReceiver', - 'protocol = TEST_PROTOCOL', - is_async=True, - private=True, - ) + smod = TEST_PROTOCOL.do_create_receiver_module( + 'TestAsyncMessageReceiver', + 'protocol = TEST_PROTOCOL', + is_async=True, + private=True, ) # Clip everything up to our first class declaration. diff --git a/tools/efro/message/_protocol.py b/tools/efro/message/_protocol.py index cd9fcd50..3c24c5b0 100644 --- a/tools/efro/message/_protocol.py +++ b/tools/efro/message/_protocol.py @@ -416,12 +416,10 @@ class MessageProtocol: f'{ccind}\n' f' super().__init__(protocol)\n' f'\n' - f' def __get__(self,\n' - f' obj: Any,\n' - f' type_in: Any = None)' - f' -> {ppre}Bound{basename}:\n' - f' return {ppre}Bound{basename}' - f'(obj, self)\n' + f' def __get__(\n' + f' self, obj: Any, type_in: Any = None\n' + f' ) -> {ppre}Bound{basename}:\n' + f' return {ppre}Bound{basename}(obj, self)\n' f'\n' f'\n' f'class {ppre}Bound{basename}(BoundMessageSender):\n' @@ -562,6 +560,7 @@ class MessageProtocol: f' -> Callable[[Any, {msgtypevar}], {rtypevar}]:\n' f' """Decorator to register message handlers."""\n' f' from typing import cast, Callable, Any\n' + f'\n' f' self.register_handler(cast(Callable' f'[[Any, Message], Response], call))\n' f' return call\n' @@ -603,28 +602,26 @@ class MessageProtocol: if is_async: out += ( '\n' - ' async def handle_raw_message(self,\n' - ' message: str,\n' - ' raise_unregistered: bool =' - ' False) -> str:\n' + ' async def handle_raw_message(\n' + ' self, message: str, raise_unregistered: bool = False\n' + ' ) -> str:\n' ' """Asynchronously handle a raw incoming message."""\n' - ' return await self._receiver.handle_raw_message_async(' - '\n' - ' self._obj, message, raise_unregistered)\n' + ' return await self._receiver.' + 'handle_raw_message_async(\n' + ' self._obj, message, raise_unregistered\n' + ' )\n' ) else: out += ( '\n' - ' def handle_raw_message(self,\n' - ' message: str,\n' - ' raise_unregistered: bool = False)' - ' -> str:\n' + ' def handle_raw_message(\n' + ' self, message: str, raise_unregistered: bool = False\n' + ' ) -> str:\n' ' """Synchronously handle a raw incoming message."""\n' - ' return self._receiver.handle_raw_message(' - 'self._obj, message,\n' - ' ' - 'raise_unregistered)\n' + ' return self._receiver.handle_raw_message(\n' + ' self._obj, message, raise_unregistered\n' + ' )\n' ) return out diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index e07849e1..291c8b58 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -13,6 +13,7 @@ from typing import TYPE_CHECKING from efrotools.filecache import FileCache + if TYPE_CHECKING: from typing import Any diff --git a/tools/efrotools/pcommand.py b/tools/efrotools/pcommand.py index b75bf53f..8a5a66a1 100644 --- a/tools/efrotools/pcommand.py +++ b/tools/efrotools/pcommand.py @@ -528,6 +528,16 @@ def _filter_tool_config(cfg: str) -> str: cfg = cfg.replace('__EFRO_MYPY_STANDARD_SETTINGS__', mypy_standard_settings) + name = '__PYTHON_BLACK_EXTRA_ARGS__' + if name in cfg: + from efrotools.code import black_base_args + + bargs = black_base_args() + assert bargs[2] == 'black' + cfg = cfg.replace( + name, '(' + ' '.join(f'"{b}"' for b in bargs[3:]) + ')' + ) + # Gen a pylint init to set up our python paths: pylint_init_tag = '__EFRO_PYLINT_INIT__' if pylint_init_tag in cfg: