mirror of
https://github.com/meshtastic/python.git
synced 2026-01-05 14:27:54 -05:00
add typing hints
This commit is contained in:
@@ -3,9 +3,11 @@ set -e
|
||||
# You may consider running: "pytest -m smoke1" instead of this test.
|
||||
|
||||
echo "Linting"
|
||||
|
||||
poetry run pylint meshtastic examples/ --ignore-patterns ".*_pb2.pyi?$"
|
||||
|
||||
echo "Checking types"
|
||||
poetry run mypy meshtastic/
|
||||
|
||||
echo "Running (crude) prerelease tests to verify sanity"
|
||||
|
||||
# Use the python environment created by poetry
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
"""A basic implementation of the observer pattern."""
|
||||
|
||||
import typing
|
||||
|
||||
class Event:
|
||||
"""A simple event class."""
|
||||
|
||||
def __init__(self, source) -> None:
|
||||
self.source = source
|
||||
|
||||
def __getattr__(self, name: str) -> typing.Any:
|
||||
"""We dynamically add attributes to this class, so stub out __getattr__ so that mypy doesn't complain."""
|
||||
pass
|
||||
|
||||
class Observable:
|
||||
"""A class that represents an observable object.
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class PowerMonClient:
|
||||
self.rawData = pd.DataFrame(columns=self.columns) # use time as the index
|
||||
|
||||
# for efficiency reasons we keep new data in a list - only adding to rawData when needfed
|
||||
self.newData = []
|
||||
self.newData: list[dict] = []
|
||||
|
||||
self.power = power = PowerSupply(portName)
|
||||
power.powerOn()
|
||||
|
||||
39
poetry.lock
generated
39
poetry.lock
generated
@@ -814,8 +814,8 @@ files = [
|
||||
[package.dependencies]
|
||||
numpy = [
|
||||
{version = ">=1.22.4", markers = "python_version < \"3.11\""},
|
||||
{version = ">=1.26.0", markers = "python_version >= \"3.12\""},
|
||||
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
|
||||
{version = ">=1.26.0", markers = "python_version >= \"3.12\""},
|
||||
]
|
||||
python-dateutil = ">=2.8.2"
|
||||
pytz = ">=2020.1"
|
||||
@@ -846,6 +846,24 @@ sql-other = ["SQLAlchemy (>=2.0.0)", "adbc-driver-postgresql (>=0.8.0)", "adbc-d
|
||||
test = ["hypothesis (>=6.46.1)", "pytest (>=7.3.2)", "pytest-xdist (>=2.2.0)"]
|
||||
xml = ["lxml (>=4.9.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "pandas-stubs"
|
||||
version = "2.2.2.240603"
|
||||
description = "Type annotations for pandas"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "pandas_stubs-2.2.2.240603-py3-none-any.whl", hash = "sha256:e08ce7f602a4da2bff5a67475ba881c39f2a4d4f7fccc1cba57c6f35a379c6c0"},
|
||||
{file = "pandas_stubs-2.2.2.240603.tar.gz", hash = "sha256:2dcc86e8fa6ea41535a4561c1f08b3942ba5267b464eff2e99caeee66f9e4cd1"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
numpy = [
|
||||
{version = ">=1.23.5", markers = "python_version >= \"3.9\" and python_version < \"3.12\""},
|
||||
{version = ">=1.26.0", markers = "python_version >= \"3.12\" and python_version < \"3.13\""},
|
||||
]
|
||||
types-pytz = ">=2022.1.1"
|
||||
|
||||
[[package]]
|
||||
name = "pdoc3"
|
||||
version = "0.10.0"
|
||||
@@ -1026,8 +1044,8 @@ astroid = ">=3.2.2,<=3.3.0-dev0"
|
||||
colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
|
||||
dill = [
|
||||
{version = ">=0.2", markers = "python_version < \"3.11\""},
|
||||
{version = ">=0.3.7", markers = "python_version >= \"3.12\""},
|
||||
{version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""},
|
||||
{version = ">=0.3.7", markers = "python_version >= \"3.12\""},
|
||||
]
|
||||
isort = ">=4.2.5,<5.13.0 || >5.13.0,<6"
|
||||
mccabe = ">=0.6,<0.8"
|
||||
@@ -1349,9 +1367,9 @@ pyserial = "^3.5"
|
||||
|
||||
[package.source]
|
||||
type = "git"
|
||||
url = "https://github.com/geeksville/riden.git#ecbda543cf566346dd28558d957b4aa7fe116a83"
|
||||
url = "https://github.com/geeksville/riden.git#1.2.1"
|
||||
reference = "HEAD"
|
||||
resolved_reference = "ecbda543cf566346dd28558d957b4aa7fe116a83"
|
||||
resolved_reference = "a1fbecd54c3346f573277a06489b42957a6fd520"
|
||||
|
||||
[[package]]
|
||||
name = "setuptools"
|
||||
@@ -1447,6 +1465,17 @@ files = [
|
||||
{file = "types_protobuf-5.26.0.20240422-py3-none-any.whl", hash = "sha256:e4dc2554d342501d5aebc3c71203868b51118340e105fc190e3a64ca1be43831"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-pytz"
|
||||
version = "2024.1.0.20240417"
|
||||
description = "Typing stubs for pytz"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "types-pytz-2024.1.0.20240417.tar.gz", hash = "sha256:6810c8a1f68f21fdf0f4f374a432487c77645a0ac0b31de4bf4690cf21ad3981"},
|
||||
{file = "types_pytz-2024.1.0.20240417-py3-none-any.whl", hash = "sha256:8335d443310e2db7b74e007414e74c4f53b67452c0cb0d228ca359ccfba59659"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-pyyaml"
|
||||
version = "6.0.12.20240311"
|
||||
@@ -1783,4 +1812,4 @@ tunnel = []
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.9,<3.13"
|
||||
content-hash = "b893063a1dfe925f901dc45b01d68e255e2bd0ba68bda54de83c875c17b964d8"
|
||||
content-hash = "8263f20a372fbae7bf88b74a40931cb9e8b6b49d12942d91d960c12142b5a979"
|
||||
|
||||
@@ -29,7 +29,7 @@ types-requests = "^2.31.0.20240406"
|
||||
types-setuptools = "^69.5.0.20240423"
|
||||
types-pyyaml = "^6.0.12.20240311"
|
||||
packaging = "^24.0"
|
||||
riden = {git = "https://github.com/geeksville/riden.git#ecbda543cf566346dd28558d957b4aa7fe116a83"}
|
||||
riden = {git = "https://github.com/geeksville/riden.git#1.2.1"}
|
||||
pandas = "^2.2.2"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
@@ -41,6 +41,7 @@ autopep8 = "^2.1.0"
|
||||
pylint = "^3.2.3"
|
||||
pytap2 = "^2.3.0"
|
||||
pyinstaller = "^6.8.0"
|
||||
pandas-stubs = "^2.2.2.240603"
|
||||
|
||||
[tool.poetry.extras]
|
||||
tunnel = ["pytap2"]
|
||||
|
||||
Reference in New Issue
Block a user