Improve metadata and auxiliary methods of existing packets.

* Add multi-attribute aliases to some packets, for user convenience.
* Add support for writing PlayerListItemPacket.
* Add 'fields' attributes to manually-read/written packet classes,
  implementing 'field_string' where appropriate to allow enable the
  default __repr__ implementation.
* Modify data constructors where appropriate so that __repr__
  implementations match their constructor protocols.
* Improve comments on type aliases within packet classes.
* Add/modify tests to cover the new functionality.
This commit is contained in:
joodicator committed 2019-06-08 15:39:24 +02:00
1 parent 234e57716c
commit e3d2b1a368
14 files changed
+389 -158

No files matched your search

+3 -2
View File
@@ -112,8 +112,9 @@ class Packet(object):
str = '0x%02X %s' % (self.id, str)
fields = self.fields
if fields is not None:
str = '%s(%s)' % (str, ', '.join('%s=%s' %
(a, self.field_string(a)) for a in fields))
inner_str = ', '.join('%s=%s' % (a, self.field_string(a))
for a in fields if hasattr(self, a))
str = '%s(%s)' % (str, inner_str)
return str
@property