Skip to content

Commit

Permalink
Use python standard toml when available
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagocoutinho committed Sep 2, 2024
1 parent f94dd66 commit f5f82e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modbus_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (c) 2020-2021 Tiago Coutinho
# Distributed under the GPLv3 license. See LICENSE for more info.


import sys
import asyncio
import pathlib
import argparse
Expand Down Expand Up @@ -227,7 +227,10 @@ def load_config(file_name):
file_name = pathlib.Path(file_name)
ext = file_name.suffix
if ext.endswith("toml"):
from toml import load
if sys.version_info >= (3, 11):
from tomllib import load
else:
from toml import load
elif ext.endswith("yml") or ext.endswith("yaml"):
import yaml

Expand Down

0 comments on commit f5f82e7

Please sign in to comment.