Skip to content

Commit

Permalink
Add black dependency and format code with it
Browse files Browse the repository at this point in the history
  • Loading branch information
oversize committed Jan 24, 2024
1 parent 9eef7ad commit 38865cb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
3 changes: 2 additions & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest
pytest-cov
pytest-cov
black
19 changes: 5 additions & 14 deletions src/blockperf/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def setup_logger(debug: bool):
},
"extra": {
"format": "%(asctime)-16s %(name)-8s %(filename)-12s %(lineno)-6s %(funcName)-30s %(levelname)-8s %(message)s",
"datefmt": "%m-%d %H:%M:%S"
}
"datefmt": "%m-%d %H:%M:%S",
},
},
"handlers": {
"console": {
Expand All @@ -54,16 +54,8 @@ def setup_logger(debug: bool):
# "backupCount": 2,
# }
},
"loggers": {
"blockperf": {
"level": "DEBUG",
"handlers": []
}
},
"root": {
"level": level,
"handlers": ["console"]
}
"loggers": {"blockperf": {"level": "DEBUG", "handlers": []}},
"root": {"level": level, "handlers": ["console"]},
}
dictConfig(logger_config)

Expand All @@ -74,8 +66,7 @@ def setup_argparse():
parser.add_argument(
"command", help="Command to run blockperf with", choices=["run"]
)
parser.add_argument(
"--debug", help="Write more debug output", action="store_true")
parser.add_argument("--debug", help="Write more debug output", action="store_true")
return parser.parse_args()


Expand Down
6 changes: 4 additions & 2 deletions src/blockperf/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
from paho.mqtt.client import MQTTMessageInfo
from paho.mqtt.properties import Properties as Properties

try:
import paho.mqtt.client as mqtt
from paho.mqtt.properties import Properties
Expand All @@ -31,7 +32,7 @@ def __init__(
client_keyfile: str,
host: str,
port: int,
keepalive: int
keepalive: int,
) -> None:
super().__init__(protocol=mqtt.MQTTv5)
self.tls_set(
Expand Down Expand Up @@ -86,7 +87,8 @@ def publish(self, topic: str, payload: dict):
logger.info("Publishing sample to %s", topic)
# call the actuall clients publish method and receive the message_info
message_info: MQTTMessageInfo = super().publish(
topic=topic, payload=json_payload, properties=publish_properties)
topic=topic, payload=json_payload, properties=publish_properties
)
# The message_info might not yet have been published,
# wait_for_publish() blocks until TIMEOUT for that message to be published
message_info.wait_for_publish(PUBLISH_TIMEOUT)
Expand Down
8 changes: 6 additions & 2 deletions src/blockperf/nodelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ def __init__(self, event_data: dict) -> None:
):
self.local_addr = self.data.get("peer", {}).get("local", {}).get("addr", "")
self.local_port = self.data.get("peer", {}).get("local", {}).get("port", "")
self.remote_addr = self.data.get("peer", {}).get("remote", {}).get("addr", "")
self.remote_port = self.data.get("peer", {}).get("remote", {}).get("port", "")
self.remote_addr = (
self.data.get("peer", {}).get("remote", {}).get("addr", "")
)
self.remote_port = (
self.data.get("peer", {}).get("remote", {}).get("port", "")
)

def __repr__(self):
_kind = self.kind.value
Expand Down

0 comments on commit 38865cb

Please sign in to comment.