Adds a BitTornado.Types namespace, to centralize the definitions of simple data structures. Adds tests for all (nontrivial) new types and a number of pre-existing types.
New types:
UnsignedInt - Bounded integer that can be subclassed with a bit length
UnsignedShort - 16-bit integer
Port - Alias for UnsignedShort
FixedLengthBytes - bytes objects with fixed length
SixBytes - 6-byte string, used to encode (IP/port)
TwentyBytes - 20-byte string
Infohash - SHA-1 hash digest
PeerID - peer/tracker ID strings
DictSet - Set represented as dict with all values = True
Relocated/refactored types:
Address - Subclassed from UnsignedInt
IP
IPv4/IPv6
TypedDict/TypedList - Heavily refactored to conform to dict/list APIs
Adds a
BitTornado.Types
namespace, to centralize the definitions of simple data structures. Adds tests for all (nontrivial) new types and a number of pre-existing types.New types:
UnsignedInt
- Bounded integer that can be subclassed with a bit lengthUnsignedShort
- 16-bit integerPort
- Alias forUnsignedShort
FixedLengthBytes
-bytes
objects with fixed lengthSixBytes
- 6-byte string, used to encode (IP/port)TwentyBytes
- 20-byte stringInfohash
- SHA-1 hash digestPeerID
- peer/tracker ID stringsDictSet
- Set represented asdict
with all values =True
Relocated/refactored types:
Address
- Subclassed fromUnsignedInt
IP
IPv4
/IPv6
TypedDict
/TypedList
- Heavily refactored to conform todict
/list
APIsBitfield
/TrueBitfield
OrderedSet