Skip to content

Commit 5b1aebb

Browse files
committed
Merge pull request #30 from ddemidov/master
Stop polluting global namespace
2 parents 50878ee + e9ef343 commit 5b1aebb

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

ev3dev.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,70 +1664,70 @@ def brightness_pct(self, value):
16641664
Led.green_right = Led(name='ev3-right1:green:ev3dev')
16651665

16661666
@staticmethod
1667-
def Led_mix_colors(red, green):
1667+
def _Led_mix_colors(red, green):
16681668
Led.red_left.brightness_pct = red
16691669
Led.red_right.brightness_pct = red
16701670
Led.green_left.brightness_pct = green
16711671
Led.green_right.brightness_pct = green
1672-
Led.mix_colors = Led_mix_colors
1672+
Led.mix_colors = _Led_mix_colors
16731673

16741674
@staticmethod
1675-
def Led_set_red(pct):
1675+
def _Led_set_red(pct):
16761676
Led.mix_colors(red=1*pct, green=0*pct)
1677-
Led.set_red = Led_set_red
1677+
Led.set_red = _Led_set_red
16781678

16791679
@staticmethod
1680-
def Led_red_on():
1680+
def _Led_red_on():
16811681
Led.set_red(1)
1682-
Led.red_on = Led_red_on
1682+
Led.red_on = _Led_red_on
16831683

16841684
@staticmethod
1685-
def Led_set_green(pct):
1685+
def _Led_set_green(pct):
16861686
Led.mix_colors(red=0*pct, green=1*pct)
1687-
Led.set_green = Led_set_green
1687+
Led.set_green = _Led_set_green
16881688

16891689
@staticmethod
1690-
def Led_green_on():
1690+
def _Led_green_on():
16911691
Led.set_green(1)
1692-
Led.green_on = Led_green_on
1692+
Led.green_on = _Led_green_on
16931693

16941694
@staticmethod
1695-
def Led_set_amber(pct):
1695+
def _Led_set_amber(pct):
16961696
Led.mix_colors(red=1*pct, green=1*pct)
1697-
Led.set_amber = Led_set_amber
1697+
Led.set_amber = _Led_set_amber
16981698

16991699
@staticmethod
1700-
def Led_amber_on():
1700+
def _Led_amber_on():
17011701
Led.set_amber(1)
1702-
Led.amber_on = Led_amber_on
1702+
Led.amber_on = _Led_amber_on
17031703

17041704
@staticmethod
1705-
def Led_set_orange(pct):
1705+
def _Led_set_orange(pct):
17061706
Led.mix_colors(red=1*pct, green=0.5*pct)
1707-
Led.set_orange = Led_set_orange
1707+
Led.set_orange = _Led_set_orange
17081708

17091709
@staticmethod
1710-
def Led_orange_on():
1710+
def _Led_orange_on():
17111711
Led.set_orange(1)
1712-
Led.orange_on = Led_orange_on
1712+
Led.orange_on = _Led_orange_on
17131713

17141714
@staticmethod
1715-
def Led_set_yellow(pct):
1715+
def _Led_set_yellow(pct):
17161716
Led.mix_colors(red=0.5*pct, green=1*pct)
1717-
Led.set_yellow = Led_set_yellow
1717+
Led.set_yellow = _Led_set_yellow
17181718

17191719
@staticmethod
1720-
def Led_yellow_on():
1720+
def _Led_yellow_on():
17211721
Led.set_yellow(1)
1722-
Led.yellow_on = Led_yellow_on
1722+
Led.yellow_on = _Led_yellow_on
17231723

17241724
@staticmethod
1725-
def Led_all_off():
1725+
def _Led_all_off():
17261726
Led.red_left.brightness = 0
17271727
Led.red_right.brightness = 0
17281728
Led.green_left.brightness = 0
17291729
Led.green_right.brightness = 0
1730-
Led.all_off = Led_all_off
1730+
Led.all_off = _Led_all_off
17311731

17321732

17331733
#~autogen
@@ -1738,26 +1738,26 @@ def Led_all_off():
17381738
Led.blue_two = Led(name='brickpi2:blue:ev3dev')
17391739

17401740
@staticmethod
1741-
def Led_mix_colors(blue):
1741+
def _Led_mix_colors(blue):
17421742
Led.blue_one.brightness_pct = blue
17431743
Led.blue_two.brightness_pct = blue
1744-
Led.mix_colors = Led_mix_colors
1744+
Led.mix_colors = _Led_mix_colors
17451745

17461746
@staticmethod
1747-
def Led_set_blue(pct):
1747+
def _Led_set_blue(pct):
17481748
Led.mix_colors(blue=1*pct)
1749-
Led.set_blue = Led_set_blue
1749+
Led.set_blue = _Led_set_blue
17501750

17511751
@staticmethod
1752-
def Led_blue_on():
1752+
def _Led_blue_on():
17531753
Led.set_blue(1)
1754-
Led.blue_on = Led_blue_on
1754+
Led.blue_on = _Led_blue_on
17551755

17561756
@staticmethod
1757-
def Led_all_off():
1757+
def _Led_all_off():
17581758
Led.blue_one.brightness = 0
17591759
Led.blue_two.brightness = 0
1760-
Led.all_off = Led_all_off
1760+
Led.all_off = _Led_all_off
17611761

17621762

17631763
#~autogen

templates/led-colors.liquid

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
endfor %}
55

66
@staticmethod
7-
def Led_mix_colors({%
7+
def _Led_mix_colors({%
88
for group in currentClass.groups%}{{ group.name | downcase | underscore_spaces }}{%
99
unless forloop.last %}, {% endunless %}{%
1010
endfor %}):{%
@@ -15,27 +15,27 @@ for group in currentClass.groups %}{%
1515
Led.{{instanceName}}.brightness_pct = {{groupName}}{%
1616
endfor %}{%
1717
endfor %}
18-
Led.mix_colors = Led_mix_colors
18+
Led.mix_colors = _Led_mix_colors
1919
{% for color in currentClass.colors %}{%
2020
assign colorName = color.name | downcase | underscore_spaces %}
2121
@staticmethod
22-
def Led_set_{{ colorName }}(pct):
22+
def _Led_set_{{ colorName }}(pct):
2323
Led.mix_colors({%
2424
for group in color.groups %}{{ group.name | downcase | underscore_spaces }}={{ group.value }}*pct{%
2525
unless forloop.last %}, {% endunless %}{%
2626
endfor %})
27-
Led.set_{{ colorName }} = Led_set_{{ colorName }}
27+
Led.set_{{ colorName }} = _Led_set_{{ colorName }}
2828

2929
@staticmethod
30-
def Led_{{ colorName }}_on():
30+
def _Led_{{ colorName }}_on():
3131
Led.set_{{ colorName }}(1)
32-
Led.{{ colorName }}_on = Led_{{ colorName }}_on
32+
Led.{{ colorName }}_on = _Led_{{ colorName }}_on
3333
{% endfor %}
3434
@staticmethod
35-
def Led_all_off():{%
35+
def _Led_all_off():{%
3636
for instance in currentClass.instances %}{%
3737
assign instanceName = instance.name | downcase | underscore_spaces %}
3838
Led.{{instanceName}}.brightness = 0{%
3939
endfor %}
40-
Led.all_off = Led_all_off
40+
Led.all_off = _Led_all_off
4141

0 commit comments

Comments
 (0)