Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/infuse_iot/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import binascii

from collections import defaultdict
from typing import List, Dict, Tuple
from typing import List, Dict


class ValidationError(Exception):
Expand Down Expand Up @@ -267,7 +267,6 @@ def __str__(self):
class WriteInstr(Instr):
class WriteU4(ctypes.LittleEndianStructure):
op = OpCode.WRITE_LEN_U4
length = 1
_fields_ = [
("opcode", ctypes.c_uint8),
]
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/epacket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import random

from typing import List, Dict, Tuple, Any
from typing import List, Dict, Tuple
from typing_extensions import Self

from infuse_iot.util.crypto import chachapoly_decrypt, chachapoly_encrypt
Expand Down
1 change: 0 additions & 1 deletion src/infuse_iot/rpc_wrappers/bt_disconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from infuse_iot.generated.rpc_definitions import (
rpc_struct_bt_addr_le,
rpc_enum_bt_le_addr_type,
rpc_enum_infuse_bt_characteristic,
)
from infuse_iot.util.argparse import BtLeAddress
from infuse_iot.util.ctypes import bytes_to_uint8
Expand Down
1 change: 0 additions & 1 deletion src/infuse_iot/rpc_wrappers/wifi_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class response(ctypes.LittleEndianStructure):
@classmethod
def from_buffer_copy(cls, source, offset=0):
values = []
num = source[0]
source = source[1:]
while len(source) > 0:

Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/tdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ctypes
import enum

from typing import List, Dict
from typing import List

from infuse_iot.time import InfuseTime
from infuse_iot.generated import tdf_definitions
Expand Down
4 changes: 3 additions & 1 deletion src/infuse_iot/tools/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ class SubCommand(InfuseCommand):

@classmethod
def add_parser(cls, parser):
subparser = parser.add_subparsers(title="commands", metavar="<command>")
subparser = parser.add_subparsers(
title="commands", metavar="<command>", required=True
)

Organisations.add_parser(subparser)
Boards.add_parser(subparser)
Expand Down
3 changes: 0 additions & 3 deletions src/infuse_iot/tools/csv_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def make_plots(self):

def run(self):
from dash import Dash, dcc, html, Input, Output, State, callback
import numpy as np
import pandas as pd

# Read data, add label column
Expand All @@ -53,8 +52,6 @@ def run(self):
[self.labels[0] for _ in range(self.df.shape[0])],
)

# print(self.df.index.iloc[0])

app = Dash()
app.layout = html.Div(
[
Expand Down
39 changes: 24 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
# Benefits of using tox:
#
# 1. makes sure we are testing west as installed by setup.py
# 1. makes sure we are testing module as installed by pyproject.toml
# 2. avoid touching user global / system config files
# 3. avoid touching any git repositories outside of tmpdirs
# 4. ensure global / system config settings have no effect on the tests

[tox]
envlist=py3

[pycodestyle]
# We explicitly disable the following errors:
#
# - E126: continuation line over-indented for hanging indent
# - E261: at least two spaces before inline comment
# - E302: expected 2 blank lines, found 1
# - E305: expected 2 blank lines after class or function definition, found 1
# - W504: line break after binary operator
ignore = E126,E261,E302,E305,W504
# Don't lint setup.py, the .tox or python virtualenv directory, or the build directory
exclude = setup.py,.tox,.venv,build
max-line-length = 120
[tool.ruff]
line-length = 120
indent-width = 4

[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"SIM", # flake8-simplify
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"SIM108", # Allow if-else blocks instead of forcing ternary operator
"UP027", # deprecated pyupgrade rule
]

[tool.ruff.format]
line-ending = "lf"

[testenv]
deps =
setuptools-scm
pytest
pytest-cov
types-PyYAML
black
ruff
setenv =
# For instance: ./.tox/py3/tmp/
TOXTEMPDIR={envtmpdir}
commands =
python -m pytest --basetemp='{envtmpdir}/pytest with space/'
python -m black --check '{toxinidir}' --extend-exclude 'api_client|tdf_definitions.py|rpc_definitions.py'
python -m ruff check '{toxinidir}' --extend-exclude 'api_client|tdf_definitions.py|rpc_definitions.py'