Fix up pylint from merged PR

This commit is contained in:
Ian McEwen
2024-04-02 15:15:22 -07:00
parent 4c97866875
commit b57d1d81ff
4 changed files with 2 additions and 4 deletions

View File

@@ -12,7 +12,6 @@ from datetime import datetime
import google.protobuf.json_format
import timeago # type: ignore[import-untyped]
from google.protobuf.json_format import MessageToJson
from pubsub import pub # type: ignore[import-untyped]
from tabulate import tabulate

View File

@@ -5,8 +5,6 @@ import base64
import logging
import time
from google.protobuf.json_format import MessageToJson
from meshtastic import admin_pb2, apponly_pb2, channel_pb2, localonly_pb2, portnums_pb2
from meshtastic.util import (
Timeout,

View File

@@ -551,6 +551,7 @@ def test_active_ports_on_supported_devices_mac_duplicates_check(mock_platform, m
@pytest.mark.unit
def test_message_to_json_shows_all():
"""Test that message_to_json prints fields that aren't included in data passed in"""
actual = json.loads(message_to_json(MyNodeInfo()))
expected = { "myNodeNum": 0, "rebootCount": 0, "minAppVersion": 0 }
assert actual == expected

View File

@@ -614,5 +614,5 @@ def check_if_newer_version():
return pypi_version
def message_to_json(message):
"Return protobuf message as JSON. Always print all fields, even when not present in data."
return stripnl(MessageToJson(message, always_print_fields_with_no_presence=True))