Data Management

class yodel.Field(name: str, _type: Type, *args, bytes=0, min=0, max=0)[source]

A field is a section of memory meant to hold one value

Parameters
  • name – name of field

  • _type – data type to use in field

  • bytes – when applicable this can hold the length of the field

supported_types = [<class 'int'>, <class 'str'>, <class 'bytearray'>, <class 'yodel.dynamicheaders.Flags'>]
class yodel.Flags(lookup_table: list)[source]

Class meant to be used in fields, is an array of bools, used to store flags about the packet.

Parameters

lookup_table – list of strings used to map keys to bits

class yodel.Format(fields: List, mtype: int = 0)[source]

formats are used to store the information needed to encode or decode data. eg: first 3 bytes are a string, next 5 are for an int, etc.

Parameters
  • fields – list of field objects that will define the format

  • mtype – short for message type, allows unique identifiers to be given to your format that will be sent along with the format allowing for the receiver to know what format to use to decode the message

class yodel.Section(format: yodel.dynamicheaders.Format)[source]

sections are used to store data and the meta-data needed to encode that data. to get extract all of the data in a section use: section.fields

sections can be encoded by using bytes(section), also, if a section is used in yodel.send it will automatically handle it.

Parameters

format – format object to be used when encoding this section

print()[source]