Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmholder committed Apr 3, 2023
1 parent 1698f1c commit 4447ef0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Aryan Battula
Panya Bhinder

Ion Li

Caroline Kerr
1 change: 1 addition & 0 deletions EosLib/device.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import IntEnum, unique


@unique
class Device(IntEnum):
NO_DEVICE = 0
Expand Down
1 change: 1 addition & 0 deletions EosLib/packet/data_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from EosLib.packet.exceptions import PacketFormatError, DataHeaderFormatError
from EosLib.device import Device


class DataHeader:

data_header_struct_format_string = "!" \
Expand Down
1 change: 1 addition & 0 deletions EosLib/packet/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from EosLib.packet.exceptions import PacketFormatError
from EosLib.device import Device


class Packet:
radio_max_bytes = 255
radio_body_max_bytes = radio_max_bytes - (struct.calcsize(TransmitHeader.transmit_header_struct_format_string)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ about the transmission of the packet, typically via radio.
### `DataHeader` Contents

| Field | Variable Type | Valid Range | Required? |
| -------------------- | ----------------------- | ---------------------------- | --------- |
|----------------------|-------------------------|------------------------------|-----------|
| Packet Type | PacketType enum | Values in PacketType | Yes |
| Packet Sender | PacketDevice enum | Values in Device | Yes |
| Packet Priority | PacketPriority enum\*\* | Values in PacketPriority\*\* | Yes |
Expand All @@ -31,7 +31,7 @@ about the transmission of the packet, typically via radio.
### `TransmitHeader` Contents

| Field | Variable Type | Valid Range | Required? |
| ---------------------- | ------------- | -------------- | --------- |
|------------------------|---------------|----------------|-----------|
| Packet Sequence Number | Int | 0-255 | Yes |
| Packet Timestamp | datetime | Any valid date | Yes\* |

Expand All @@ -47,7 +47,7 @@ To avoid using strings in packet bodies, EosLib contains some pre-made data form
### `Position` Format

| Field | Variable Type | Unit |
| -------------------- | ---------------- | --------------- |
|----------------------|------------------|-----------------|
| Timestamp | datetime | datetime |
| Latitude | float | decimal degrees |
| Longitude | float | decimal degrees |
Expand All @@ -66,7 +66,7 @@ good sanity check/first pass validity check.
### `Telemetry` Format

| Field | Variable Type | Unit |
| ----------- | ------------- | -------- |
|-------------|---------------|----------|
| Timestamp | datetime | datetime |
| Temperature | float | celsius |
| Pressure | float | mbar |
Expand Down
3 changes: 2 additions & 1 deletion example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import random

import EosLib.device
import EosLib.packet.definitions
import EosLib.packet.packet
import EosLib.packet.transmit_header
Expand All @@ -15,7 +16,7 @@ def collect_data() -> int:
# This takes the data and generates a packet with a data header according to our needs
def log_data(data):
data_header = DataHeader(
EosLib.Device.PRESSURE,
EosLib.device.Device.PRESSURE,
EosLib.Type.DATA,
EosLib.Priority.DATA
)
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
attrs==22.1.0
colorama==0.4.5
iniconfig==1.1.1
packaging==21.3
attrs==22.2.0
colorama==0.4.6
iniconfig==2.0.0
packaging==23.0
pluggy==1.0.0
pyparsing==3.0.9
pytest==7.2.1
pytest==7.2.2
tomli==2.0.1
4 changes: 2 additions & 2 deletions tests/packet/test_packet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest

import EosLib
import EosLib.packet.definitions as definitions

from datetime import datetime
Expand Down Expand Up @@ -174,6 +173,7 @@ def test_standalone_transmit_header_validate():
with pytest.raises(PacketFormatError):
TransmitHeader.decode(test_header)


def test_encode_decode_packet(packet):
model_packet = get_valid_packet()

Expand Down Expand Up @@ -263,7 +263,7 @@ def test_packet_data_header_only(packet):


def test_packet_no_headers(packet):
# This shouldn't ever happen, but is a possible state so we should test for it.
# This shouldn't ever happen, but is a possible state, so we should test for it.

packet.data_header = None
packet.transmit_header = None
Expand Down

0 comments on commit 4447ef0

Please sign in to comment.