Skip to content

Commit 7599fc6

Browse files
committed
Some more pylint fun
1 parent 88aa5fb commit 7599fc6

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.pylintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
disable=
33
too-many-arguments,
44
unused-argument,
5-
duplicate-code
5+
duplicate-code,
6+
consider-using-f-string,
7+
consider-using-from-import

mqtt_io/__main__.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .modules import install_missing_requirements
2121
from .server import MqttIo
2222

23-
_LOG = logging.getLogger('mqtt_io.__main__')
23+
_LOG = logging.getLogger("mqtt_io.__main__")
2424

2525

2626
def hashed(value: Any) -> str:
@@ -49,7 +49,7 @@ def load_config(config: str, render_config: str) -> Any:
4949
"""
5050
Loads the config, and uses confp to render it if necessary.
5151
"""
52-
with open(config, "r") as stream:
52+
with open(config, "r", encoding="utf8") as stream:
5353
if render_config:
5454
rendered = render(render_config, stream.read())
5555
raw_config = yaml.safe_load(rendered)
@@ -64,10 +64,13 @@ def main() -> None:
6464
"""
6565
parser = argparse.ArgumentParser()
6666
parser.add_argument("config")
67-
parser.add_argument("--render", help="""
67+
parser.add_argument(
68+
"--render",
69+
help="""
6870
A config file for confp for preprocessing the config file.
6971
Doesn't need to contain a template section.
70-
""")
72+
""",
73+
)
7174
args = parser.parse_args()
7275

7376
# Load, validate and normalise config, or quit.
@@ -103,7 +106,7 @@ def main() -> None:
103106
mqtt_gpio = MqttIo(config)
104107
mqtt_gpio.run()
105108
except Exception:
106-
_LOG.exception('MqttIo crashed!')
109+
_LOG.exception("MqttIo crashed!")
107110
raise
108111

109112

mqtt_io/config/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def get_main_schema() -> ConfigType:
7474
:rtype: dict
7575
"""
7676
schema_path = join(dirname(realpath(__file__)), "config.schema.yml")
77-
with open(schema_path) as schema_file:
77+
with open(schema_path, encoding="utf8") as schema_file:
7878
# We write this schema file, so we know it'll adhere to ConfigType rules
7979
return cast(ConfigType, yaml.safe_load(schema_file))
8080

@@ -172,7 +172,7 @@ def load_main_config(path: str) -> ConfigType:
172172
:param path: The filesystem path
173173
:return: The config
174174
"""
175-
with open(path, "r") as stream:
175+
with open(path, "r", encoding="utf8") as stream:
176176
raw_config = yaml.safe_load(stream)
177177
return validate_and_normalise_main_config(raw_config)
178178

mqtt_io/mqtt/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ async def publish(self, msg: MQTTMessageSend) -> None:
147147
Publish an MQTT message.
148148
"""
149149

150-
@abc.abstractproperty
150+
@property
151+
@abc.abstractmethod
151152
def message_queue(self) -> "asyncio.Queue[MQTTMessage]":
152153
"""
153154
Get the queue onto which received MQTT messages are put.

0 commit comments

Comments
 (0)