tidying after the removal of efro.entity

This commit is contained in:
Eric Froemling 2021-10-02 12:53:20 -05:00
parent 7ecb16bd7c
commit 21d5cc28c0
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
8 changed files with 5 additions and 99 deletions

View File

@ -3945,10 +3945,10 @@
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/a7/76a39b05d1db2d49dc3335679573",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/56/a1576a8bee94a47cdd633aa86a3b",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/8d/4b1084de33fe4ef3a2d0313d6330",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a4/27/cb310b4e2eeb51fb9114f6d402ea",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8a/97/ad31231721be8515b37bb3cf6fc0",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9e/1e/81ad96ec96e0a3c90fb69d24b38e",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a3/47/4f0897f4a30b2f22ce9ee73f24d0",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/6a/b2/0d7498cfc3fd49dd4bdf64b22b11",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ec/ed/434ff203ce89602bd395944d33fe",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6d/2f/c4cc9c7cb4589a50faf7db7f4c05",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f6/99/b27c665fcf9f8548abf3f162a736",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f6/e2/a712749d266aa8e6c6dade74f08d",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/70/3de0ba133d288111ae3fc386fbf5",

View File

@ -705,11 +705,6 @@ test-message:
@tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_message.py
# Individual test with extra output enabled.
test-entity:
@tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_entity.py
# Tell make which of these targets don't represent files.
.PHONY: test test-full test-assetmanager

View File

@ -497,7 +497,6 @@
"ba_data/python/efro/__pycache__/__init__.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/call.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/error.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/json.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/message.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/net.cpython-38.opt-1.pyc",
"ba_data/python/efro/__pycache__/terminal.cpython-38.opt-1.pyc",
@ -518,7 +517,6 @@
"ba_data/python/efro/dataclassio/_prep.py",
"ba_data/python/efro/dataclassio/extras.py",
"ba_data/python/efro/error.py",
"ba_data/python/efro/json.py",
"ba_data/python/efro/message.py",
"ba_data/python/efro/net.py",
"ba_data/python/efro/terminal.py",

View File

@ -651,7 +651,6 @@ SCRIPT_TARGETS_PY_PUBLIC_TOOLS = \
build/ba_data/python/efro/dataclassio/_prep.py \
build/ba_data/python/efro/dataclassio/extras.py \
build/ba_data/python/efro/error.py \
build/ba_data/python/efro/json.py \
build/ba_data/python/efro/message.py \
build/ba_data/python/efro/net.py \
build/ba_data/python/efro/terminal.py \
@ -672,7 +671,6 @@ SCRIPT_TARGETS_PYC_PUBLIC_TOOLS = \
build/ba_data/python/efro/dataclassio/__pycache__/_prep.cpython-38.opt-1.pyc \
build/ba_data/python/efro/dataclassio/__pycache__/extras.cpython-38.opt-1.pyc \
build/ba_data/python/efro/__pycache__/error.cpython-38.opt-1.pyc \
build/ba_data/python/efro/__pycache__/json.cpython-38.opt-1.pyc \
build/ba_data/python/efro/__pycache__/message.cpython-38.opt-1.pyc \
build/ba_data/python/efro/__pycache__/net.cpython-38.opt-1.pyc \
build/ba_data/python/efro/__pycache__/terminal.cpython-38.opt-1.pyc \

View File

@ -38,7 +38,6 @@ class State:
files: Annotated[Dict[str, FileValue],
IOAttrs('files')] = field(default_factory=dict)
# files = entity.CompoundDictField('files', str, FileValue())
class AssetManager:

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2021-10-01 for Ballistica version 1.6.5 build 20393</em></h4>
<h4><em>last updated on 2021-10-02 for Ballistica version 1.6.5 build 20393</em></h4>
<p>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 <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>

View File

@ -20,11 +20,8 @@ if TYPE_CHECKING:
class ServerNodeEntry:
"""Information about a specific server."""
region: Annotated[str, IOAttrs('r')]
# region = entity.Field('r', entity.StringValue())
address: Annotated[str, IOAttrs('a')]
# address = entity.Field('a', entity.StringValue())
port: Annotated[int, IOAttrs('p')]
# port = entity.Field('p', entity.IntValue())
@ioprepped
@ -34,16 +31,11 @@ class ServerNodeQueryResponse:
# If present, something went wrong, and this describes it.
error: Annotated[Optional[str], IOAttrs('e', store_default=False)] = None
# error =
# entity.Field('e', entity.OptionalStringValue(store_default=False))
# The set of servernodes.
servers: Annotated[List[ServerNodeEntry],
IOAttrs('s', store_default=False)] = field(
default_factory=list)
# servers = entity.CompoundListField('s',
# ServerNodeEntry(),
# store_default=False)
@ioprepped

View File

@ -1,76 +0,0 @@
# Released under the MIT License. See LICENSE for details.
#
"""Custom json compressor/decompressor with support for more data times/etc."""
from __future__ import annotations
import datetime
import json
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any
# NOTE: This functionality is duplicated in a newer, cleaner way in
# dataclassio. We should consider deprecating this along with entity at
# some point.
# Special attr we included for our extended type information
# (extended-json-type)
TYPE_TAG = '_xjtp'
_pytz_utc: Any
# We don't *require* pytz since it must be installed through pip
# but it is used by firestore client for its utc tzinfos.
# (in which case it should be installed as a dependency anyway)
try:
import pytz
_pytz_utc = pytz.utc
except ModuleNotFoundError:
_pytz_utc = None # pylint: disable=invalid-name
class ExtendedJSONEncoder(json.JSONEncoder):
"""Custom json encoder supporting additional types."""
def default(self, o: Any) -> Any:
if isinstance(o, datetime.datetime):
# We only support timezone-aware utc times.
if (o.tzinfo is not datetime.timezone.utc
and (_pytz_utc is None or o.tzinfo is not _pytz_utc)):
raise ValueError(
'datetime values must have timezone set as timezone.utc')
return {
TYPE_TAG:
'dt',
'v': [
o.year, o.month, o.day, o.hour, o.minute, o.second,
o.microsecond
],
}
return super().default(o)
class ExtendedJSONDecoder(json.JSONDecoder):
"""Custom json decoder supporting extended types."""
def __init__(self, *args: Any, **kwargs: Any):
json.JSONDecoder.__init__(self,
object_hook=self.object_hook,
*args,
**kwargs)
def object_hook(self, obj: Any) -> Any: # pylint: disable=E0202
"""Custom hook."""
if TYPE_TAG not in obj:
return obj
objtype = obj[TYPE_TAG]
if objtype == 'dt':
vals = obj.get('v', [])
if len(vals) != 7:
raise ValueError('malformed datetime value')
return datetime.datetime( # type: ignore
*vals, tzinfo=datetime.timezone.utc)
return obj