Skip to content

Commit da0312a

Browse files
committed
more miscellaneous types
1 parent 919ae8c commit da0312a

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

meshtastic/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import List, NoReturn, Union
1515

1616
from google.protobuf.json_format import MessageToJson
17+
from google.protobuf.message import Message
1718

1819
import packaging.version as pkg_version
1920
import requests
@@ -103,7 +104,7 @@ def pskToString(psk: bytes):
103104
return "secret"
104105

105106

106-
def stripnl(s):
107+
def stripnl(s) -> str:
107108
"""Remove newlines from a string (and remove extra whitespace)"""
108109
s = str(s).replace("\n", " ")
109110
return " ".join(s.split())
@@ -628,7 +629,7 @@ def check_if_newer_version():
628629
return pypi_version
629630

630631

631-
def message_to_json(message, multiline=False):
632+
def message_to_json(message: Message, multiline: bool=False) -> str:
632633
"""Return protobuf message as JSON. Always print all fields, even when not present in data."""
633634
json = MessageToJson(message, always_print_fields_with_no_presence=True)
634635
return stripnl(json) if not multiline else json

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bleak
2323
packaging
2424
mypy
2525
mypy-protobuf
26-
types-protobuf
26+
types-protobuf>=5.26.0
2727
types-tabulate
2828
types-requests
2929
types-setuptools

0 commit comments

Comments
 (0)