From 0206f386fa937f97ee8cc1d0ebfcd0b70e4f2fd8 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Tue, 22 Dec 2020 09:51:16 -0800 Subject: [PATCH] tidying --- .idea/dictionaries/ericf.xml | 12 ++++++------ docs/ba_module.md | 2 +- tests/test_efro/test_dataclasses.py | 1 + tests/test_efro/test_entity.py | 7 +++++++ tools/efro/entity/_entity.py | 1 + 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 71ef1564..d44a5176 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -30,8 +30,8 @@ achname achs acinstance - ack'ed ack + ack'ed acked acks acnt @@ -155,8 +155,8 @@ bacommon badguy bafoundation - ballistica's ballistica + ballistica's ballisticacore ballisticacorecb bamaster @@ -815,8 +815,8 @@ gamedata gameinstance gamemap - gamepad's gamepad + gamepad's gamepadadvanced gamepads gamepadselect @@ -1207,8 +1207,8 @@ lsqlite lssl lstart - lstr's lstr + lstr's lstrs lsval ltex @@ -1847,8 +1847,8 @@ sessionname sessionplayer sessionplayers - sessionteam's sessionteam + sessionteam's sessionteams sessiontype setactivity @@ -2184,8 +2184,8 @@ txtw typeargs typecheck - typechecker's typechecker + typechecker's typedval typeshed typestr diff --git a/docs/ba_module.md b/docs/ba_module.md index f369e93e..35c72152 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-12-21 for Ballistica version 1.5.29 build 20262

+

last updated on 2020-12-21 for Ballistica version 1.5.29 build 20263

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/tests/test_efro/test_dataclasses.py b/tests/test_efro/test_dataclasses.py index 344dbb28..2185cd2b 100644 --- a/tests/test_efro/test_dataclasses.py +++ b/tests/test_efro/test_dataclasses.py @@ -169,6 +169,7 @@ def test_validate() -> None: dataclass_validate(tclass) # No longer valid. + # noinspection PyTypeHints tclass.ival = None # type: ignore with pytest.raises(TypeError): dataclass_validate(tclass) diff --git a/tests/test_efro/test_entity.py b/tests/test_efro/test_entity.py index b9487526..88c32a57 100644 --- a/tests/test_efro/test_entity.py +++ b/tests/test_efro/test_entity.py @@ -73,6 +73,7 @@ def test_entity_values() -> None: # Simple int field. with pytest.raises(TypeError): + # noinspection PyTypeHints ent.ival = 'strval' # type: ignore assert static_type_equals(ent.ival, int) assert isinstance(ent.ival, int) @@ -82,6 +83,7 @@ def test_entity_values() -> None: # Simple float field. with pytest.raises(TypeError): + # noinspection PyTypeHints ent.fval = 'foo' # type: ignore assert static_type_equals(ent.fval, float) ent.fval = 2 @@ -98,6 +100,7 @@ def test_entity_values() -> None: assert len(ent.slval) == 1 assert list(ent.slval) == ['blah'] with pytest.raises(TypeError): + # noinspection PyTypeHints ent.slval = ['foo', 'bar', 1] # type: ignore # Simple value dict field. @@ -133,6 +136,7 @@ def test_entity_values_2() -> None: assert static_type_equals(ent.grp.isubval, int) assert isinstance(ent.grp.isubval, int) with pytest.raises(TypeError): + # noinspection PyTypeHints ent.grp.isubval = 'blah' # type: ignore # Compound value inheritance. @@ -166,6 +170,7 @@ def test_entity_values_2() -> None: # Enum value with pytest.raises(ValueError): + # noinspection PyTypeHints ent.enumval = None # type: ignore assert ent.enumval == EnumTest.FIRST @@ -231,6 +236,7 @@ def test_field_copies() -> None: # And not if they don't... # (in this case mypy errors too but that may not always be the case) with pytest.raises(ValueError): + # noinspection PyTypeHints ent1.compoundlist3 = ent1.compoundlist # type: ignore # Copying a CompoundDict @@ -249,6 +255,7 @@ def test_field_copies() -> None: # two CompoundValues have the same type but different layouts based # on their __init__ args or whatnot) with pytest.raises(ValueError): + # noinspection PyTypeHints ent1.compounddict3 = ent1.compounddict # type: ignore # Make sure invalid key types get caught when setting a full dict: with pytest.raises(TypeError): diff --git a/tools/efro/entity/_entity.py b/tools/efro/entity/_entity.py index 10aeae74..6a3d3942 100644 --- a/tools/efro/entity/_entity.py +++ b/tools/efro/entity/_entity.py @@ -103,6 +103,7 @@ class EntityMixin: self.d_data = target.d_data # Make sure target blows up if someone tries to use it. + # noinspection PyTypeHints target.d_data = None # type: ignore def pruned_data(self) -> Dict[str, Any]: