From ed8f1865dde28a03423f7d43ce679771d1f1083a Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Sat, 4 Jun 2022 14:30:15 -0700 Subject: [PATCH] Tidying, lang-updates, and Node.getdelegate() bug fix --- .efrocachemap | 96 +++++++++---------- CHANGELOG.md | 2 +- assets/src/ba_data/python/._ba_sources_hash | 2 +- src/ballistica/ballistica.cc | 2 +- .../python/class/python_class_node.cc | 5 + tests/test_efro/test_message.py | 38 ++++---- tools/efro/message/_protocol.py | 42 ++++---- tools/efro/message/_receiver.py | 7 +- tools/efrotools/__init__.py | 10 +- tools/efrotools/code.py | 16 ++-- tools/efrotools/statictest.py | 6 +- 11 files changed, 119 insertions(+), 107 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 5dd105db..3241abda 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -420,10 +420,10 @@ "assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/dc/d2/160fc27fcaff10793327ac2c70fd", "assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/11/7a/87d6bca0acfb877fd4fd8fe3a598", "assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/44/f5/c943c9075abb3e1835d2408a1ef8", - "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/bd/6c/48e30d0a2215958f8ae1a02805ba", + "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/74/3f/0f47e4d22a9f17adc91ed1a9d426", "assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/ca/75/3de74bd6e498113b99bbf9eda645", "assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/61/03/89070ca765e06da3a419a579f503", - "assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/f6/21/951b7ff02b0ad14b1f0ac55763c4", + "assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/61/ee/f19a0aacec20e49dd16c206b6c69", "assets/build/ba_data/data/languages/chinesetraditional.json": "https://files.ballistica.net/cache/ba1/61/e6/caf06ce99017fdf5d2da0c038445", "assets/build/ba_data/data/languages/croatian.json": "https://files.ballistica.net/cache/ba1/28/46/3a36628a033da4d4b4ea65b78a28", "assets/build/ba_data/data/languages/czech.json": "https://files.ballistica.net/cache/ba1/87/84/9f3d39610453b3bf350698a23316", @@ -444,13 +444,13 @@ "assets/build/ba_data/data/languages/persian.json": "https://files.ballistica.net/cache/ba1/02/ab/e310f81582b6dc2ae93348d45166", "assets/build/ba_data/data/languages/polish.json": "https://files.ballistica.net/cache/ba1/d5/fe/422745cdbe51ccb4f2ced6f5554a", "assets/build/ba_data/data/languages/portuguese.json": "https://files.ballistica.net/cache/ba1/26/41/f1246ab56c6b7853f605c3a95889", - "assets/build/ba_data/data/languages/romanian.json": "https://files.ballistica.net/cache/ba1/39/2b/27822a4e66093ca8bfb968099507", + "assets/build/ba_data/data/languages/romanian.json": "https://files.ballistica.net/cache/ba1/f4/74/a9e2f85b531061703d08a4118bed", "assets/build/ba_data/data/languages/russian.json": "https://files.ballistica.net/cache/ba1/b2/46/89ae228342f20ca4937ee254197b", "assets/build/ba_data/data/languages/serbian.json": "https://files.ballistica.net/cache/ba1/13/19/828be486951be254445263f36c6e", "assets/build/ba_data/data/languages/slovak.json": "https://files.ballistica.net/cache/ba1/f9/4b/d9f01814224066856695452ef57c", "assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/87/5d/d36a8a2e9cb0f02731a3fd7af000", "assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/91/0a/35c4baf539d5951fc03a794c0e0b", - "assets/build/ba_data/data/languages/tamil.json": "https://files.ballistica.net/cache/ba1/cb/11/e11957be752c3dc552898b60ab20", + "assets/build/ba_data/data/languages/tamil.json": "https://files.ballistica.net/cache/ba1/97/40/ed284d7ae135b9aff73295cf1f9c", "assets/build/ba_data/data/languages/thai.json": "https://files.ballistica.net/cache/ba1/9d/51/f699dbd4beb88bc3cff699a287a7", "assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/0a/4f/90fcd63bd12a7648b2a1e9b01586", "assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/7f/bb/6239adeb551be5e09f3457d7b411", @@ -3992,50 +3992,50 @@ "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/f4/32/9d4fcc5184cc84a3bcd491ec7192", - "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/60/be/d645a8c2894281041caaed88996a", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a6/37/dc865c1fbe87adb9bc9c6deff002", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e2/02/d9edfae05b0939743e51ff8ae908", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9d/f9/72c235af6f5f869f895e98da2271", - "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e7/b6/a0ee0372339a39b9b0e851e90960", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/eb/e032554943773d2d1eebe88ad7ab", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3a/06/6d9b1d59e7a84a10ff12d9e7986d", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/91/d8/b43991661b523cdcf16d2cc28530", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f7/af/fa49caccf09056cdb4740f33bad2", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/95/4bcb6ac9dbcf85f95e1d93fa9690", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7c/93/93c8f76ac399dfd15b0855471c0b", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/86/10/dd263a61886a23b9f070975b3d81", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/fb/ad/4ea35be3c9ac3e84cf1d0dbe1d9e", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/84/39/2434d512db771fe9b7e89ceaa134", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2c/af/c8b0e5f68441ee3f105211790656", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2c/e8/9944f707235323ca9ca0be3e372d", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8f/05/b0b13ed8da0e04c20168d85ff997", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/fb/9e/0eb1802d0a709283946b8608a837", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/c9/5a/feaec46d12cecb311c2c68e5ae20", - "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/15/7e/65c2b19ea93a259c53ce2f40f1a9", - "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/82/42/dc48db3497a332642837bf4b0b58", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/39/cb8d0308e194f7009547fb36ef7d", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/33/be/18a2ed8f42ff70a273d195e335a9", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/be/4c/9214c24d52ceab82babbfc087363", - "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/91/6ec90d4444e2d8104161361cd3c9", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a7/ce/cd9fa30993fb964b2f920b0a87c0", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/29/2b/ba8830a2bf981a1f1baa62b5941e", - "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/73/16/1ffaf6dc1bed1f94ae855e72b55c", - "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1b/0f/bc40ad4779100ff3a21133033ffe", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/a1/7a5e3522a0630758319cd39cceb0", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9a/a4/dd5a0be067adbc67b2a1278840a7", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ce/d4/6902395063514cf2a550fe258925", - "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/c1/d618c8d26e9f845791fc9f41e022", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/46/ff/0671960fbe8e77599e55a590979b", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/79/5f0e75b95aae11fa53b19fa3eb36", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/0b/34/202a0f4892d35f23341f4ad8f661", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/20/c0/4a6cc65902a0b819589de1bb17be", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3d/c1/8eefaabc68e7246fa8cb7244147a", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e0/10/50475bccb5df48c3375c55ff2160", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/1d/e5/defa913c57893c82307de7b5120c", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/98/4b/5eba04f89559430fa20312df11e3", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/68/2f/cb56da2caabc1e3eca790e91d897", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/8a/6c/e271ac59657aa6e7b510dde82879", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/35/3a/7154f1d68cbbf6385a5bd30ee9c7", + "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5e/de/942f9b29988507e7eed6560d1c36", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c8/eb/bd36b8642913a175e941d6fd677b", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/db/3ad5a5d3cf39c13070c7417c1ea8", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/26/d2/45de55656879d6076f44c658fbef", + "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d3/64/4207002a29c983786854acf6b3f6", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5c/d4/792a3d1333fdcba06c98c29c38aa", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/46/96/569942db74df7015de7e1057c659", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5e/aa/96a5631cb56588985b6292b14888", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/75/52/f82f426ab6a220e4e837996b27b0", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/90/d8/f530458f0fa28a9ada1bb41f9cc1", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6f/35/34d6ae79b4e3f4e392886ea608e9", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cf/d2/2f21aed70201c803dad373259820", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/9e/60649024d1a108229328a24aa06a", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5e/b0/b74f311577abc35e3f53c808ebe2", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/33/a5/29dc1fa65253e06e4bb12ef2d91b", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0d/91/e3f975ebcfba3e905603efb9d42c", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0d/1c/fd94d469dcaa490ed94d0100be31", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/69/45/9cb5dd1bd2f3789d1277de2e13fe", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/8a/f8/1d87b32ffc6b352d8a51a826e612", + "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/72/9d/7041244c1532e8739f4144a0dbdb", + "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f9/d3/43568f3cfbf7b9e1f1c0a80d3cbb", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1d/d7/9508dda5f67d8120159fc27e5aa6", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/32/19/422f06dd741d5fecd501192345db", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a3/e0/532750ec3447a0d2507297ef7e06", + "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/07/f4/07c76f58e65817f064a6f8eb947a", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/fb/ceab54e3526c6754978d599feea3", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/87/5534e303798640c45eebb3ff2a78", + "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ec/71/2b6c9e9920857db9d4f08e13a147", + "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d4/cd/475d49a92f27e1023c4c9929f229", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/23/02/efb19178a0c9f32e7dd1a74c6e0f", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6c/8b/239dd8045dbdd3f674557dcea6f6", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/eb/28/f681d90ec4fc218081d27a54b524", + "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b3/5e/11e126f42e97c2ad8fbbdedbddeb", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/32/80/f5b20ad75c2822c99472832588f0", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ae/bc/1dfe7e5f4991b790eb28b4655b97", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/22/90/e3e1510d320434dce98c2f2f4bd7", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/41/83/cc82f715fd3b766b8e99cd3e47f3", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3b/01/b0131177be78b774f7645a25d9fa", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/74/53/922f030cdb5f6631f30d9918cdac", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/71/20/4a9cd20befe66687c3409577dbfe", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/fd/d4/b0984f40c5c005e1ba9c9b5c0b6b", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3a/2c/2ae55b591d38a78d82a8d929ec45", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/dc/fa/b8cd1ec4ec21748c8cdecd1d857e", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/6e/6f/004b696e9a13b083069374e4bb6a", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/d3/db/e73d4dcf1280d5f677c3cf8b47c3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5b2e03..7396c70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.1 (20594, 2022-06-03) +### 1.7.1 (20597, 2022-06-04) - V2 account logic fixes - Polishing V2 web-based login flow diff --git a/assets/src/ba_data/python/._ba_sources_hash b/assets/src/ba_data/python/._ba_sources_hash index 7d7463c1..336728d7 100644 --- a/assets/src/ba_data/python/._ba_sources_hash +++ b/assets/src/ba_data/python/._ba_sources_hash @@ -1 +1 @@ -320920970228380339335842674313265345034 \ No newline at end of file +234583871401016050573124413381187163584 \ No newline at end of file diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index e2fc4bbd..9a8f5181 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20594; +const int kAppBuildNumber = 20597; const char* kAppVersion = "1.7.1"; // Our standalone globals. diff --git a/src/ballistica/python/class/python_class_node.cc b/src/ballistica/python/class/python_class_node.cc index 0ad9ed7e..9a1c4f47 100644 --- a/src/ballistica/python/class/python_class_node.cc +++ b/src/ballistica/python/class/python_class_node.cc @@ -220,6 +220,11 @@ auto PythonClassNode::GetDelegate(PythonClassNode* self, PyObject* args, PyExcType::kDelegateNotFound); } } + } else { + if (doraise) { + throw Exception("No delegate set on '" + node->type()->name() + "' node.", + PyExcType::kDelegateNotFound); + } } Py_RETURN_NONE; BA_PYTHON_CATCH; diff --git a/tests/test_efro/test_message.py b/tests/test_efro/test_message.py index eb669650..8fd40b40 100644 --- a/tests/test_efro/test_message.py +++ b/tests/test_efro/test_message.py @@ -6,7 +6,7 @@ from __future__ import annotations import os import asyncio -from typing import TYPE_CHECKING, overload, Union +from typing import TYPE_CHECKING, overload from dataclasses import dataclass import pytest @@ -20,7 +20,7 @@ from efro.message import (Message, Response, MessageProtocol, MessageSender, EmptyResponse) if TYPE_CHECKING: - from typing import Any, Callable, Optional, Awaitable + from typing import Any, Callable, Awaitable @ioprepped @@ -134,14 +134,14 @@ class _BoundTestMessageSenderSync(BoundMessageSender): ... @overload - def send(self, message: _TMsg2) -> Union[_TResp1, _TResp2]: + def send(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload def send(self, message: _TMsg3) -> None: ... - def send(self, message: Message) -> Optional[Response]: + def send(self, message: Message) -> Response | None: """Send a message synchronously.""" return self._sender.send(self._obj, message) @@ -173,14 +173,14 @@ class _BoundTestMessageSenderAsync(BoundMessageSender): ... @overload - async def send_async(self, message: _TMsg2) -> Union[_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: Message) -> Optional[Response]: + async def send_async(self, message: Message) -> Response | None: """Send a message asynchronously.""" return await self._sender.send_async(self._obj, message) @@ -212,7 +212,7 @@ class _BoundTestMessageSenderBBoth(BoundMessageSender): ... @overload - def send(self, message: _TMsg2) -> Union[_TResp1, _TResp2]: + def send(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload @@ -223,7 +223,7 @@ class _BoundTestMessageSenderBBoth(BoundMessageSender): def send(self, message: _TMsg4) -> None: ... - def send(self, message: Message) -> Optional[Response]: + def send(self, message: Message) -> Response | None: """Send a message synchronously.""" return self._sender.send(self._obj, message) @@ -232,7 +232,7 @@ class _BoundTestMessageSenderBBoth(BoundMessageSender): ... @overload - async def send_async(self, message: _TMsg2) -> Union[_TResp1, _TResp2]: + async def send_async(self, message: _TMsg2) -> _TResp1 | _TResp2: ... @overload @@ -243,7 +243,7 @@ class _BoundTestMessageSenderBBoth(BoundMessageSender): async def send_async(self, message: _TMsg4) -> None: ... - async def send_async(self, message: Message) -> Optional[Response]: + async def send_async(self, message: Message) -> Response | None: """Send a message asynchronously.""" return await self._sender.send_async(self._obj, message) @@ -323,8 +323,8 @@ class _TestSyncMessageReceiver(MessageReceiver): @overload def handler( self, - call: Callable[[Any, _TMsg2], Union[_TResp1, _TResp2]], - ) -> Callable[[Any, _TMsg2], Union[_TResp1, _TResp2]]: + call: Callable[[Any, _TMsg2], _TResp1 | _TResp2], + ) -> Callable[[Any, _TMsg2], _TResp1 | _TResp2]: ... @overload @@ -383,8 +383,8 @@ class _TestAsyncMessageReceiver(MessageReceiver): @overload def handler( self, - call: Callable[[Any, _TMsg2], Awaitable[Union[_TResp1, _TResp2]]], - ) -> Callable[[Any, _TMsg2], Awaitable[Union[_TResp1, _TResp2]]]: + call: Callable[[Any, _TMsg2], Awaitable[_TResp1 | _TResp2]], + ) -> Callable[[Any, _TMsg2], Awaitable[_TResp1 | _TResp2]]: ... @overload @@ -749,8 +749,7 @@ def test_full_pipeline() -> None: test_handling_unregistered = False - def __init__(self, target: Union[TestClassRSync, - TestClassRAsync]) -> None: + def __init__(self, target: TestClassRSync | TestClassRAsync) -> None: self.test_sidecar = False self._target = target @@ -814,8 +813,7 @@ def test_full_pipeline() -> None: return out @receiver.handler - def handle_test_message_2(self, - msg: _TMsg2) -> Union[_TResp1, _TResp2]: + def handle_test_message_2(self, msg: _TMsg2) -> _TResp1 | _TResp2: """Test.""" del msg # Unused return _TResp2(fval=1.2) @@ -854,8 +852,8 @@ def test_full_pipeline() -> None: return _TResp1(bval=True) @receiver.handler - async def handle_test_message_2( - self, msg: _TMsg2) -> Union[_TResp1, _TResp2]: + async def handle_test_message_2(self, + msg: _TMsg2) -> _TResp1 | _TResp2: """Test.""" del msg # Unused return _TResp2(fval=1.2) diff --git a/tools/efro/message/_protocol.py b/tools/efro/message/_protocol.py index 97f6a4fa..526a9fa7 100644 --- a/tools/efro/message/_protocol.py +++ b/tools/efro/message/_protocol.py @@ -19,7 +19,7 @@ from efro.message._message import (Message, Response, ErrorResponse, UnregisteredMessageIDError) if TYPE_CHECKING: - from typing import Any, Optional, Literal + from typing import Any, Literal class MessageProtocol: @@ -151,7 +151,7 @@ class MessageProtocol: opname: str) -> dict: """Encode a message to a json string for transport.""" - m_id: Optional[int] = ids_by_type.get(type(message)) + m_id: int | None = ids_by_type.get(type(message)) if m_id is None: raise TypeError(f'{opname} type is not registered in protocol:' f' {type(message)}') @@ -182,7 +182,7 @@ class MessageProtocol: def _from_dict(self, data: dict, types_by_id: dict[int, type[Any]], opname: str) -> Any: """Decode a message from a json string.""" - msgdict: Optional[dict] + msgdict: dict | None m_id = data.get('t') # Allow omitting 'm' dict if its empty. @@ -200,7 +200,7 @@ class MessageProtocol: def _get_module_header(self, part: Literal['sender', 'receiver'], - extra_import_code: Optional[str] = None) -> str: + extra_import_code: str | None = None) -> str: """Return common parts of generated modules.""" # pylint: disable=too-many-locals, too-many-branches import textwrap @@ -270,9 +270,10 @@ class MessageProtocol: tpimport_lines = textwrap.indent(tpimport_lines, ' ') # We need Optional for sender-modules with multiple types - baseimps = ['Union', 'Any'] - if part == 'sender' and len(msgtypes) > 1: - baseimps.append('Optional') + # UPDATE: Not anymore with 3.10 + baseimps = ['Any'] + # if part == 'sender' and len(msgtypes) > 1: + # baseimps.append('Optional') if part == 'receiver': baseimps.append('Callable') baseimps_s = ', '.join(baseimps) @@ -301,7 +302,7 @@ class MessageProtocol: enable_sync_sends: bool, enable_async_sends: bool, private: bool = False, - protocol_module_level_import_code: Optional[str] = None) -> str: + protocol_module_level_import_code: str | None = None) -> str: """Used by create_sender_module(); do not call directly.""" # pylint: disable=too-many-locals import textwrap @@ -354,8 +355,9 @@ class MessageProtocol: msgtypevar = msgtype.__name__ rtypes = msgtype.get_response_types() if len(rtypes) > 1: - tps = ', '.join(_filt_tp_name(t) for t in rtypes) - rtypevar = f'Union[{tps}]' + rtypevar = ' | '.join(_filt_tp_name(t) for t in rtypes) + # tps = ', '.join(_filt_tp_name(t) for t in rtypes) + # rtypevar = f'Union[{tps}]' else: rtypevar = _filt_tp_name(rtypes[0]) out += (f'\n' @@ -373,8 +375,10 @@ class MessageProtocol: msgtypevar = msgtype.__name__ rtypes = msgtype.get_response_types() if len(rtypes) > 1: - tps = ', '.join(_filt_tp_name(t) for t in rtypes) - rtypevar = f'Union[{tps}]' + rtypevar = ' | '.join( + _filt_tp_name(t) for t in rtypes) + # tps = ', '.join(_filt_tp_name(t) for t in rtypes) + # rtypevar = f'Union[{tps}]' else: rtypevar = _filt_tp_name(rtypes[0]) out += (f'\n' @@ -385,7 +389,7 @@ class MessageProtocol: f' ...\n') out += (f'\n' f' {pfx}def send{sfx}(self, message: Message)' - f' -> Optional[Response]:\n' + f' -> Response | None:\n' f' """Send a message {how}."""\n' f' return {awt}self._sender.' f'send{sfx}(self._obj, message)\n') @@ -398,7 +402,7 @@ class MessageProtocol: protocol_create_code: str, is_async: bool, private: bool = False, - protocol_module_level_import_code: Optional[str] = None) -> str: + protocol_module_level_import_code: str | None = None) -> str: """Used by create_receiver_module(); do not call directly.""" # pylint: disable=too-many-locals import textwrap @@ -443,8 +447,9 @@ class MessageProtocol: msgtypevar = msgtype.__name__ rtypes = msgtype.get_response_types() if len(rtypes) > 1: - tps = ', '.join(_filt_tp_name(t) for t in rtypes) - rtypevar = f'Union[{tps}]' + rtypevar = ' | '.join(_filt_tp_name(t) for t in rtypes) + # tps = ', '.join(_filt_tp_name(t) for t in rtypes) + # rtypevar = f'Union[{tps}]' else: rtypevar = _filt_tp_name(rtypes[0]) rtypevar = f'{cbgn}{rtypevar}{cend}' @@ -466,8 +471,9 @@ class MessageProtocol: msgtypevar = msgtype.__name__ rtypes = msgtype.get_response_types() if len(rtypes) > 1: - tps = ', '.join(_filt_tp_name(t) for t in rtypes) - rtypevar = f'Union[{tps}]' + rtypevar = ' | '.join(_filt_tp_name(t) for t in rtypes) + # tps = ', '.join(_filt_tp_name(t) for t in rtypes) + # rtypevar = f'Union[{tps}]' else: rtypevar = _filt_tp_name(rtypes[0]) rtypevar = f'{cbgn}{rtypevar}{cend}' diff --git a/tools/efro/message/_receiver.py b/tools/efro/message/_receiver.py index 1d114a99..36cada02 100644 --- a/tools/efro/message/_receiver.py +++ b/tools/efro/message/_receiver.py @@ -6,6 +6,7 @@ Supports static typing for message types and possible return types. from __future__ import annotations +import types import inspect import logging from typing import TYPE_CHECKING @@ -103,7 +104,7 @@ class MessageReceiver: responsetypes: tuple[Union[type[Any], type[None]], ...] # Return types can be a single type or a union of types. - if isinstance(ret, _GenericAlias): + if isinstance(ret, (_GenericAlias, types.UnionType)): targs = get_args(ret) if not all(isinstance(a, type) for a in targs): raise TypeError(f'expected only types for "return" annotation;' @@ -113,7 +114,9 @@ class MessageReceiver: if not isinstance(ret, type): raise TypeError(f'expected one or more types for' f' "return" annotation; got a {type(ret)}.') - responsetypes = (ret, ) + # This seems like maybe a mypy bug. Appeared after adding + # types.UnionType above. + responsetypes = (ret, ) # type: ignore # Return type of None translates to EmptyResponse. responsetypes = tuple(EmptyResponse if r is type(None) else r diff --git a/tools/efrotools/__init__.py b/tools/efrotools/__init__.py index 74bc0168..4fd12899 100644 --- a/tools/efrotools/__init__.py +++ b/tools/efrotools/__init__.py @@ -18,7 +18,7 @@ from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: - from typing import Union, Sequence, Optional, Any, Literal + from typing import Sequence, Any, Literal # Python major version we're using for all this stuff. PYVER = '3.10' @@ -84,13 +84,13 @@ def get_public_license(style: str) -> str: raise RuntimeError(f'Invalid style: {style}') -def readfile(path: Union[str, Path]) -> str: +def readfile(path: str | Path) -> str: """Read a text file and return a str.""" with open(path, encoding='utf-8') as infile: return infile.read() -def writefile(path: Union[str, Path], txt: str) -> None: +def writefile(path: str | Path, txt: str) -> None: """Write a string to a file.""" with open(path, 'w', encoding='utf-8') as outfile: outfile.write(txt) @@ -109,7 +109,7 @@ def replace_exact(opstr: str, old: str, new: str, count: int = 1) -> str: return opstr.replace(old, new) -def get_files_hash(filenames: Sequence[Union[str, Path]], +def get_files_hash(filenames: Sequence[str | Path], extrahash: str = '', int_only: bool = False, hashtype: Literal['md5', 'sha256'] = 'md5') -> str: @@ -148,7 +148,7 @@ def _py_symbol_at_column(line: str, col: int) -> str: def py_examine(projroot: Path, filename: Path, line: int, column: int, - selection: Optional[str], operation: str) -> None: + selection: str | None, operation: str) -> None: """Given file position info, performs some code inspection.""" # pylint: disable=too-many-locals # pylint: disable=cyclic-import diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index e6b31aaf..3d87dcae 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -13,7 +13,7 @@ from typing import TYPE_CHECKING from efrotools.filecache import FileCache if TYPE_CHECKING: - from typing import Any, Union, Optional + from typing import Any def format_clang_format(projroot: Path, full: bool) -> None: @@ -365,9 +365,9 @@ def _dirty_dep_check(fname: str, filestates: dict[str, bool], cache: FileCache, return dirty -def _run_pylint(projroot: Path, pylintrc: Union[Path, str], - cache: Optional[FileCache], dirtyfiles: list[str], - allfiles: Optional[list[str]]) -> dict[str, Any]: +def _run_pylint(projroot: Path, pylintrc: Path | str, cache: FileCache | None, + dirtyfiles: list[str], + allfiles: list[str] | None) -> dict[str, Any]: import time from pylint import lint from efro.error import CleanError @@ -623,9 +623,9 @@ def _parse_idea_results(path: Path) -> int: error_count = 0 root = Et.parse(str(path)).getroot() for child in root: - line: Optional[str] = None - description: Optional[str] = None - fname: Optional[str] = None + line: str | None = None + description: str | None = None + fname: str | None = None if child.tag == 'problem': is_error = True for pchild in child: @@ -753,7 +753,7 @@ def _run_idea_inspections_cached(cachepath: Path, md5.update(infile.read()) current_hash = md5.hexdigest() - existing_hash: Optional[str] + existing_hash: str | None try: with open(cachepath, encoding='utf-8') as infile2: existing_hash = json.loads(infile2.read())['hash'] diff --git a/tools/efrotools/statictest.py b/tools/efrotools/statictest.py index 5774a385..e7f55414 100644 --- a/tools/efrotools/statictest.py +++ b/tools/efrotools/statictest.py @@ -11,7 +11,7 @@ import subprocess import logging if TYPE_CHECKING: - from typing import Any, Optional, Union + from typing import Any # Global state: # We maintain a single temp dir where our mypy cache and our temp @@ -19,7 +19,7 @@ if TYPE_CHECKING: # in a file we haven't seen yet, we copy it into the temp dir, # filter it a bit to add reveal_type() statements, and run mypy on it. # The temp dir should tear itself down when Python exits. -_tempdir: Optional[str] = None +_tempdir: str | None = None _statictestfiles: dict[str, StaticTestFile] = {} _nextfilenum: int = 1 @@ -158,7 +158,7 @@ class StaticTestFile: return '\n'.join(lines_out) + '\n' -def static_type_equals(value: Any, statictype: Union[type, None, str]) -> bool: +def static_type_equals(value: Any, statictype: type | str | None) -> bool: """Check a type statically using mypy. If a string is passed as statictype, it is checked against the mypy