Skip to content

Commit

Permalink
Add typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
oversize committed Jan 24, 2024
1 parent 38865cb commit 1ec8380
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/blockperf/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class App:
start_time: int

# holds a dictionairy for each kind of events for each block_hash
logevents = {}
logevents: dict = {}
# the list of all published hashes, to not publish a hash twice
published_blocks = []
published_blocks: list = []
# Stores the last X hashes before they are deleted from logevents and published_blocks
working_hashes = collections.deque()
working_hashes: collections.deque = collections.deque()

def __init__(self, config: AppConfig) -> None:
self.q = queue.Queue(maxsize=50)
self.q: queue.Queue = queue.Queue(maxsize=50)
self.app_config = config
self.start_time = int(datetime.now().timestamp())

Expand Down Expand Up @@ -352,7 +352,7 @@ def logevents_logfile(self):
break

# Yield all events
logger.debug(f"Found {len(logevents)} logevents")
# logger.debug(f"Found {len(logevents)} logevents")
yield from logevents

# If no new_lines are returned check if the symlink changed
Expand Down
2 changes: 1 addition & 1 deletion src/blockperf/blocksample.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BlockSample:
# Take deltaq.G from that FetchRequest
"""

trace_events = list()
trace_events: list = []

def __init__(self, events: list) -> None:
"""Creates LogEvent and orders the events by at field"""
Expand Down
6 changes: 3 additions & 3 deletions src/blockperf/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def on_connect(self, client, userdata, flags, reasonCode, properties):
def on_connect_fail(self, client, obj):
logger.warning("Connection Failed")

def on_disconnect(self, client, userdata, reasonCode, properties) -> None:
def on_disconnect(self, client, userdata, reasonCode, properties) -> None: # type: ignore
"""Called when disconnected from broker
See paho.mqtt.client.py on_disconnect()"""
logger.warning("Connection disconnected %s", reasonCode)

def on_publish(self, client, userdata, mid) -> None:
def on_publish(self, client, userdata, mid) -> None: # type: ignore
"""Called when a message is actually received by the broker.
See paho.mqtt.client.py on_publish()"""
# There should be a way to know which messages belongs to which
Expand All @@ -74,7 +74,7 @@ def __on_log(self, client, userdata, level, buf):
"""
logger.debug("%s - %s", level, buf)

def publish(self, topic: str, payload: dict):
def publish(self, topic: str, payload: dict): # type: ignore
"""
MQTTClient publish:
Expand Down

0 comments on commit 1ec8380

Please sign in to comment.