Skip to content

Commit c6635b3

Browse files
apply consistent lang
1 parent 3d14cdf commit c6635b3

55 files changed

Lines changed: 1334 additions & 739 deletions

Some content is hidden

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

.examples/v04.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
2-
Lecture 1 - Inhertance
2+
Inhertance Example
33
"""
44

55
from machine import Pin
66
from time import sleep
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the 'Pin' Class
1111
def __init__(self, pin):
1212
super().__init__(pin, Pin.OUT)
1313

.examples/v05.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
"""
2-
Lecture 2 - Overriding Polymorphism
2+
Overriding Polymorphism Example
33
"""
44

55
from machine import Pin
66
from time import sleep
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the 'Pin' Class
1111
def __init__(self, pin, flashing=False, debug=False):
1212
super().__init__(pin, Pin.OUT)
1313
self.__debug = debug
1414
self.__pin = pin
1515
self.__flashing = flashing
1616

1717
def on(self):
18-
# method overriding polymorphism of the parent class
18+
# method overriding polymorphism of the Super Class
1919
self.high()
2020
if self.__debug:
2121
print(f"LED connected to Pin {self.__pin} is high")
2222

2323
def off(self):
24-
# method overriding polymorphism of the parent class
24+
# method overriding polymorphism of the Super Class
2525
self.low()
2626
if self.__debug:
2727
print(f"LED connected to Pin {self.__pin} is low")
@@ -33,4 +33,4 @@ def off(self):
3333
red_light.on()
3434
sleep(1)
3535
red_light.off()
36-
sleep(1)
36+
sleep(1)

.examples/v06.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
"""
2-
Lecture 2 - Polymorphism WET v DRY
2+
Polymorphism & WET v DRY Example
33
"""
44

55
from machine import Pin
66
from time import sleep
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the Super 'Pin' Class
1111
def __init__(self, pin, flashing=False, debug=False):
1212
super().__init__(pin, Pin.OUT)
1313
self.__debug = debug
1414
self.__pin = pin
1515
self.__flashing = flashing
1616

1717
def on(self):
18-
# method overriding polymorphism of the parent class
18+
# method overriding polymorphism of the Super Class
1919
self.high()
2020
if self.__debug:
2121
print(f"LED connected to Pin {self.__pin} is high")
2222

2323
def off(self):
24-
# method overriding polymorphism of the parent class
24+
# method overriding polymorphism of the Super Class
2525
self.low()
2626
if self.__debug:
2727
print(f"LED connected to Pin {self.__pin} is low")
2828

2929
def toggle(self):
30-
# method overriding polymorphism of the parent class
30+
# method overriding polymorphism of the Super Class
3131
if self.value() == 0:
32-
self.on()
32+
self.high()
33+
if self.__debug:
34+
print(f"LED connected to Pin {self.__pin} is high")
3335
elif self.value() == 1:
34-
self.off()
36+
self.low()
37+
if self.__debug:
38+
print(f"LED connected to Pin {self.__pin} is low")
39+
3540

3641
red_light = Led_Light(3, False, True)
3742

.examples/v07.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
2-
Lecture 2 - Overloading Polymorphism
2+
Overloading Polymorphism Example
33
"""
44

55
from machine import Pin
66
from time import sleep, time
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the Super 'Pin' Class
1111
def __init__(self, pin, flashing=False, debug=False):
1212
super().__init__(pin, Pin.OUT)
1313
self.led_light_state
@@ -16,19 +16,19 @@ def __init__(self, pin, flashing=False, debug=False):
1616
self.__flashing = flashing
1717

1818
def on(self):
19-
# method overriding polymorphism of the parent class
19+
# method overriding polymorphism of the Super Class
2020
self.high()
2121
if self.__debug:
2222
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2323

2424
def off(self):
25-
# method overriding polymorphism of the parent class
25+
# method overriding polymorphism of the Super Class
2626
self.low()
2727
if self.__debug:
2828
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2929

3030
def toggle(self):
31-
# method overriding polymorphism of the parent class
31+
# method overriding polymorphism of the Super Class
3232
if self.value() == 0:
3333
self.on()
3434
elif self.value() == 1:

.examples/v08.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
2-
Lecture 3 - Encapsulation
2+
Encapsulation Example
33
"""
44

55
from machine import Pin
66
from time import sleep, time
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the Super 'Pin' Class
1111
def __init__(self, pin, flashing=False, debug=False):
1212
super().__init__(pin, Pin.OUT)
1313
self.led_light_state
@@ -16,32 +16,32 @@ def __init__(self, pin, flashing=False, debug=False):
1616
self.__flashing = flashing
1717

1818
def on(self):
19-
# method overriding polymorphism of the parent class
19+
# method overriding polymorphism of the Super Class
2020
self.high()
2121
if self.__debug:
2222
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2323

2424
def off(self):
25-
# method overriding polymorphism of the parent class
25+
# method overriding polymorphism of the Super Class
2626
self.low()
2727
if self.__debug:
2828
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2929

3030
def toggle(self):
31-
# method overriding polymorphism of the parent class
31+
# method overriding polymorphism of the Super Class
3232
if self.value() == 0:
3333
self.on()
3434
elif self.value() == 1:
3535
self.off()
3636

3737
@property
3838
def led_light_state(self):
39-
# method overloading polymorphism in this class
39+
# method overloading polymorphism in this Class
4040
return self.value()
4141

4242
@led_light_state.setter
4343
def led_light_state(self, value):
44-
# method overloading polymorphism in this class
44+
# method overloading polymorphism in this Class
4545
if value == 1:
4646
self.off()
4747
elif value == 0:

.examples/v09.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
2-
Lecture 3 - Setters & Getters
2+
Setters & Getters Example
33
"""
44

55
from machine import Pin
66
from time import sleep, time
77

88

99
class Led_Light(Pin):
10-
# child class inherits the parent 'Pin' class
10+
# Sub Class inherits the Super 'Pin'
1111
def __init__(self, pin, flashing=False, debug=False):
1212
super().__init__(pin, Pin.OUT)
1313
self.led_light_state
@@ -16,32 +16,32 @@ def __init__(self, pin, flashing=False, debug=False):
1616
self.__flashing = flashing
1717

1818
def on(self):
19-
# method overriding polymorphism of the parent class
19+
# method overriding polymorphism of the Super Class
2020
self.high()
2121
if self.__debug:
2222
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2323

2424
def off(self):
25-
# method overriding polymorphism of the parent class
25+
# method overriding polymorphism of the Super Class
2626
self.low()
2727
if self.__debug:
2828
print(f"LED connected to Pin {self.__pin} is {self.led_light_state}")
2929

3030
def toggle(self):
31-
# method overriding polymorphism of the parent class
31+
# method overriding polymorphism of the Super Class
3232
if self.value() == 0:
3333
self.on()
3434
elif self.value() == 1:
3535
self.off()
3636

3737
@property
3838
def led_light_state(self):
39-
# method overloading polymorphism in this class
39+
# method overloading polymorphism in this
4040
return self.value()
4141

4242
@led_light_state.setter
4343
def led_light_state(self, value):
44-
# method overloading polymorphism in this class
44+
# method overloading polymorphism in this
4545
if value == 1:
4646
self.off()
4747
elif value == 0:

.examples/v10.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Lecture 3 - Abstraction
2+
Abstraction Example
33
"""
44

55
from project.py_scripts.LL_unit_Test import Led_Light

.examples/v11.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Lecture 3 - Extend Led_light class
2+
Extend Led_light
33
"""
44

55
from project.py_scripts.LL_unit_Test import Led_Light

.examples/v12.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Lecture 3 - Unit Test Led_light Implementation
2+
Unit Test for Led_light Class
33
"""
44

55
from time import sleep
@@ -52,7 +52,7 @@
5252
print("Testing led_light_state property (setter) to 1 (should turn on)")
5353
set1 = led.led_light_state = 1
5454
set0 = led.led_light_state = 0
55-
if set1 == 1 and set0 == 0 :
55+
if set1 == 1 and set0 == 0:
5656
print(".led_light_state setter passed")
5757
else:
5858
print(".led_light_state setter failed")

.examples/v13.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Lecture 4 - Manually unit test Pedestrian_Button Implementation
2+
Manually Unit Test for Pedestrian_Button Class
33
"""
44

55
from time import sleep
@@ -36,4 +36,4 @@
3636
else:
3737
print(".button_state setter failed")
3838

39-
print("Manual test complete.")
39+
print("Manual test complete.")

0 commit comments

Comments
 (0)