Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/callocgd/robdantic
A BaseModel implementation for Geometry Dash Responses
https://github.com/callocgd/robdantic
deserialization geometry-dash models pydantic-models pydantic-v2 python serlizable
Last synced: 22 days ago
JSON representation
A BaseModel implementation for Geometry Dash Responses
- Host: GitHub
- URL: https://github.com/callocgd/robdantic
- Owner: CallocGD
- License: wtfpl
- Created: 2024-08-20T23:25:35.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T00:01:04.000Z (5 months ago)
- Last Synced: 2024-11-08T04:17:03.530Z (3 months ago)
- Topics: deserialization, geometry-dash, models, pydantic-models, pydantic-v2, python, serlizable
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# Robdantic
A Pydantic dataclass BaseModel for decoding/encoding Geometry Dash Robtop Strings.
This is part of a planned replacement library for gdpy whith better functionality
along with a greater lifespan although everything is currently in it's concept phase
and may require a few more things but for the most part you can copy and paste the code until
I can get around to uploading this to pypi.## Examples
```python
# Note: Field is different from a Pydantic field
from robdantic import RobtopModel, Fieldclass SimpleModel(RobtopModel):
x: int = Field(key=1)
y: int = Field(key=2)model = SimpleModel.from_robtop(b"1~10~2~699", splitter=b"~")
print((model.x, model.y))
``````python
# Robdantic can also take splitter parameters as a subclass argument.
class NameModel(RobtopModel, split=b":"):
name:str = Field(key=1)model = NameModel.from_robtop(b"1:john doe")
assert model.name == "john doe"
# re-encode the model to bytes format
print(model.to_robtop())
```