A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles
Project description
A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles
sample usage
packet = parse(b'\x04\x0a\x00\xcf\x2e\xde\x1d\04') # 0.7 close
print(packet) # => <class: 'TwPacket'>: {'version': '0.7', 'header': <class: 'Header'>, 'messages': [<class: 'CtrlMessage'>]}
print(packet.header) # => <class: 'Header'>: {'flags': <class: 'PacketFlags7, 'size': 0, 'ack': 10, 'token': b'\xcf.\xde\x1d', 'num_chunks': 0}
print(packet.header.flags) # => <class: 'PacketFlags7'>: {'control': True, 'resend': False, 'compression': False, 'connless': False}
for msg in packet.messages:
print(msg.name) # => close
setup
git clone https://gitlab.com/teeworlds-network/twnet_parser
cd twnet_parser
python -m venv venv
source venv/bin/activate
pip install -r requirements
tests and linting
# dev dependencies
pip install -r requirements/dev.txt
# run unit tests
pytest .
# run style linter
pylint src/
# run type checker
mypy src/
package and release
pip install -r requirements/dev.txt
python -m build
BSD 2-Clause License
Copyright (c) 2023, ChillerDragon All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file twnet_parser-0.0.1.tar.gz
.
File metadata
- Download URL: twnet_parser-0.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c479c4bc924c82f083500e5b4a2cca10bf3b352375c490940eeacd573688f8f |
|
MD5 | 6a2a9a96ded4e18c158e60c894a688c8 |
|
BLAKE2b-256 | 6edbcbb10a7526da2ce059826c3e21175d69b336b924406c89816356ec379677 |
File details
Details for the file twnet_parser-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: twnet_parser-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b9ecc6cefcc1420a1eeae3abb1dc42d768d6df4ed648d2bcd5eade9a4fa9dfe |
|
MD5 | ed99e7699a974d24c28cb40e95e26fd4 |
|
BLAKE2b-256 | 9972a37543d805c95b2ce118d7fd4a830763410f9715ecb93f054b06b5ff0228 |