Skip to content

Commit 396f98c

Browse files
committed
Fix @philipbl knitpick
1 parent 2e35b2e commit 396f98c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+944
-141
lines changed

broadcasters/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88

99
def start_outputs(system_queue, demo_output_queue):
10+
"""
11+
Start the output processing.
12+
13+
Args:
14+
system_queue (Queue): The system queue.
15+
demo_output_queue (Queue): The demo output queue.
16+
"""
1017
try:
1118
logger.info("Loading MQTT output...")
1219
from . import mqtt

broadcasters/mqtt.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ def start_processing_output(system_queue, mqtt_q):
1515
"""
1616

1717
def on_connect(client, userdata, flags, rc):
18-
"""Callback function executed upon the successful connection to the desired broker
18+
"""
19+
Callback function executed upon the successful connection to the desired broker
1920
2021
Args:
2122
client (mqtt.Client): The client instance for this callback
@@ -26,7 +27,8 @@ def on_connect(client, userdata, flags, rc):
2627
logger.info("MQTT Client connected ({})", rc)
2728

2829
def on_disconnect(client, userdata, rc):
29-
"""Callback function executed upon disconnecting from the broker
30+
"""
31+
Callback function executed upon disconnecting from the broker
3032
3133
Args:
3234
client (mqtt.Client): The client instance for this callback
@@ -51,7 +53,8 @@ def on_disconnect(client, userdata, rc):
5153
client.on_disconnect = on_disconnect
5254

5355
def process():
54-
"""Contains generator which fetches all messages from the `byu_sss/output` topic on broker
56+
"""
57+
Contains generator which fetches all messages from the `byu_sss/output` topic on broker
5558
5659
Returns:
5760
Generator: Generator that fetches all messages from the `byu_sss/output` topic on broker

controllers/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33

44
def start_inputs(system_queue, demo_input_queue):
5+
"""
6+
Start the input processing.
7+
8+
Args:
9+
system_queue (Queue): The system queue.
10+
demo_input_queue (Queue): The demo input queue.
11+
"""
512
try:
613
logger.info("Loading MQTT input...")
714
from . import mqtt

controllers/gamepad.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def start_processing_input(system_queue, demo_input_queue):
4444
thread.start()
4545

4646
def process():
47-
"""Contains generator which fetches all messages from the `byu_sss/output` topic on broker
47+
"""
48+
Contains generator which fetches all messages from the `byu_sss/output` topic on broker
4849
4950
Returns:
5051
Generator: Generator that fetches all messages from the `byu_sss/output` topic on broker

controllers/keyboard.py

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919

2020
def check_if_sim():
21+
"""
22+
Check if the program is running in simulator mode.
23+
24+
Returns:
25+
bool: True if running in simulator mode, False otherwise.
26+
"""
2127
try:
2228
pygame.event.get()
2329
return True

controllers/mqtt.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def start_processing_input(system_queue, demo_input_queue):
1616
"""
1717

1818
def on_message(client, userdata, message):
19-
"""Callback function executed upon receiving a message from the broker
19+
"""
20+
Callback function executed upon receiving a message from the broker
2021
2122
Args:
2223
client (mqtt.Client): The client instance for this callback
@@ -44,7 +45,8 @@ def on_message(client, userdata, message):
4445
logger.error("MQTT message did not have correct keys.")
4546

4647
def on_connect(client, userdata, flags, rc):
47-
"""Callback function executed upon the successful connection to the desired broker
48+
"""
49+
Callback function executed upon the successful connection to the desired broker
4850
4951
Args:
5052
client (mqtt.Client): The client instance for this callback
@@ -59,7 +61,8 @@ def on_connect(client, userdata, flags, rc):
5961
client.subscribe("byu_sss/input")
6062

6163
def on_disconnect(client, userdata, rc):
62-
"""Callback function executed upon disconnecting from the broker
64+
"""
65+
Callback function executed upon disconnecting from the broker
6366
6467
Args:
6568
client (mqtt.Client): The client instance for this callback
@@ -85,11 +88,11 @@ def on_disconnect(client, userdata, rc):
8588
client.on_disconnect = on_disconnect
8689

8790
def process():
88-
"""Contains generator which fetches all messages from the `byu_sss/input` topic on broker
91+
"""
92+
Contains generator which fetches all messages from the `byu_sss/input` topic on broker
8993
9094
Returns:
9195
Generator: Generator that fetches all messages from the `byu_sss/input` topic on broker
92-
9396
"""
9497
logger.debug("In process func")
9598
while True:

demos/autotype/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class Autotype:
1010
# Game output is passed through output_queue
1111
# Screen updates are done through the screen object
1212
def __init__(self, input_queue, output_queue, screen):
13-
"""Constructor
13+
"""
14+
Constructor
1415
1516
Args:
1617
input_queue (Queue): Queue for user input
@@ -89,7 +90,8 @@ def stop(self):
8990
pass
9091

9192
def get_input_buff(self):
92-
"""Return the input buffer"
93+
"""
94+
Return the input buffer
9395
9496
Returns:
9597
list: List of input buffer

demos/breakout/main.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class Breakout:
2525
# Game output is passed through output_queue
2626
# Screen updates are done through the screen object
2727
def __init__(self, input_queue, output_queue, screen):
28-
"""Constructor
28+
"""
29+
Constructor
2930
3031
Args:
3132
input_queue (Queue): Input queue
@@ -285,7 +286,8 @@ def stop(self):
285286
self.gameover = True
286287

287288
def init_screen(self, screen):
288-
"""Initialize the screen with the game elements
289+
"""
290+
Initialize the screen with the game elements
289291
290292
Args:
291293
screen (Screen): The Screen object to draw on
@@ -344,7 +346,8 @@ def level_up(self):
344346
return True
345347

346348
def get_angle(self, paddle):
347-
"""Get the angle of the ball based on the paddle position
349+
"""
350+
Get the angle of the ball based on the paddle position
348351
349352
Args:
350353
paddle (list): The paddle position
@@ -362,7 +365,8 @@ def get_angle(self, paddle):
362365
return spin, is_left
363366

364367
def ball_travel(self, is_left, is_down, spin, screen):
365-
"""Move the ball based on the angle and direction
368+
"""
369+
Move the ball based on the angle and direction
366370
367371
Args:
368372
is_left (bool): The direction of the ball

demos/breakout_ai/main.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class BreakoutAi:
2626
# Screen updates are done through the screen object
2727

2828
def __init__(self, input_queue, output_queue, screen):
29-
"""Constructor
29+
"""
30+
Constructor
3031
3132
Args:
3233
input_queue (Queue): Input queue
@@ -296,7 +297,8 @@ def stop(self):
296297
pass
297298

298299
def init_screen(self, screen):
299-
"""Initialize the screen with the game elements
300+
"""
301+
Initialize the screen with the game elements
300302
301303
Args:
302304
screen (Screen): The Screen object to draw on
@@ -355,7 +357,8 @@ def level_up(self):
355357
return True
356358

357359
def get_angle(self, paddle):
358-
"""Get the angle of the ball based on the paddle position
360+
"""
361+
Get the angle of the ball based on the paddle position
359362
360363
Args:
361364
paddle (list): The paddle position
@@ -373,7 +376,8 @@ def get_angle(self, paddle):
373376
return spin, is_left
374377

375378
def ball_travel(self, is_left, is_down, spin, screen):
376-
"""Move the ball based on the angle and direction
379+
"""
380+
Move the ball based on the angle and direction
377381
378382
Args:
379383
is_left (bool): The direction of the ball
@@ -446,7 +450,8 @@ def ball_travel(self, is_left, is_down, spin, screen):
446450
return is_left, is_down
447451

448452
def predict_ball_landing(self, is_left, is_down, spin, screen):
449-
"""Predict the x position where the ball will land
453+
"""
454+
Predict the x position where the ball will land
450455
451456
Args:
452457
is_left (bool): The direction of the ball

demos/camera/_main.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Camera_Source:
1818
"""Object to hold the host and stream url of a camera source."""
1919

2020
def __init__(self, host, stream):
21-
"""Constructor
21+
"""
22+
Constructor
2223
2324
Args:
2425
host (str): Host url of the camera
@@ -28,15 +29,17 @@ def __init__(self, host, stream):
2829
self.stream_url = stream
2930

3031
def get_host(self):
31-
"""Gets the host url of the camera
32+
"""
33+
Gets the host url of the camera
3234
3335
Returns:
3436
str: Host url of the camera
3537
"""
3638
return self.host_url
3739

3840
def get_stream(self):
39-
"""Gets the stream url of the camera
41+
"""
42+
Gets the stream url of the camera
4043
4144
Returns:
4245
str: Stream url of the camera
@@ -53,7 +56,8 @@ class Camera:
5356
# Game output is passed through output_queue
5457
# Screen updates are done through the screen object
5558
def __init__(self, input_queue, output_queue, screen):
56-
"""Constructor
59+
"""
60+
Constructor
5761
5862
Args:
5963
input_queue (Queue): Queue to receive input from the user
@@ -314,5 +318,10 @@ def stop(self):
314318
pass
315319

316320
def get_input_buff(self):
317-
"""Get all input off the queue"""
321+
"""
322+
Get all input off the queue
323+
324+
Returns:
325+
list: list of all inputs in the queue
326+
"""
318327
return list(self.input_queue.queue)

demos/cell/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class Cell:
2222
demo_time = 30
2323

2424
def __init__(self, input_queue, output_queue, screen):
25-
"""Constructor
25+
"""
26+
Constructor
2627
2728
Args:
2829
input_queue (Queue): The input queue
@@ -95,7 +96,8 @@ def run(self):
9596
count += 1
9697

9798
def _map(self, x, in_min, in_max, out_min, out_max):
98-
"""Maps a value from one range to another
99+
"""
100+
Maps a value from one range to another
99101
100102
Args:
101103
x (float): The value to map

demos/checkerboard/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class Checkerboard:
77
# Game output is passed through output_queue
88
# Screen updates are done through the screen object
99
def __init__(self, input_queue, output_queue, screen):
10-
"""Constructor
10+
"""
11+
Constructor
1112
1213
Args:
1314
input_queue (Queue): The input queue

demos/circle/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class Circle:
77
# Game output is passed through output_queue
88
# Screen updates are done through the screen object
99
def __init__(self, input_queue, output_queue, screen):
10-
"""Constructor
10+
"""
11+
Constructor
1112
1213
Args:
1314
input_queue (Queue): The input queue

demos/cube/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class Cube:
1313
demo_time = 30
1414

1515
def __init__(self, input_queue, output_queue, screen):
16-
"""Constructor
16+
"""
17+
Constructor
1718
1819
Args:
1920
input_queue (Queue): The input queue

demos/digit_clock/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class DigitClock:
99
demo_time = 30
1010

1111
def __init__(self, input_queue, output_queue, screen):
12-
"""Constructor
12+
"""
13+
Constructor
1314
1415
Args:
1516
input_queue (Queue): The input queue
@@ -32,7 +33,8 @@ def run(self):
3233
trace = Trace(self.screen)
3334

3435
def draw_time(current_time, draw):
35-
"""Draw the current time on the screen
36+
"""
37+
Draw the current time on the screen
3638
3739
Args:
3840
current_time (tuple): The current time

0 commit comments

Comments
 (0)