Skip to content

Commit c23f472

Browse files
committed
SWIG: Reformat Python with black.
1 parent 038a06f commit c23f472

File tree

1 file changed

+77
-18
lines changed

1 file changed

+77
-18
lines changed

library/rpi_ws281x.py

Lines changed: 77 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# the SWIG interface file instead.
66

77
from sys import version_info as _swig_python_version_info
8+
89
if _swig_python_version_info < (2, 7, 0):
910
raise RuntimeError("Python 2.7 or later required")
1011

@@ -19,12 +20,17 @@
1920
except ImportError:
2021
import __builtin__
2122

23+
2224
def _swig_repr(self):
2325
try:
2426
strthis = "proxy of " + self.this.__repr__()
2527
except __builtin__.Exception:
2628
strthis = ""
27-
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
29+
return "<%s.%s; %s >" % (
30+
self.__class__.__module__,
31+
self.__class__.__name__,
32+
strthis,
33+
)
2834

2935

3036
def _swig_setattr_nondynamic_instance_variable(set):
@@ -37,6 +43,7 @@ def set_instance_attr(self, name, value):
3743
set(self, name, value)
3844
else:
3945
raise AttributeError("You cannot add instance attributes to %s" % self)
46+
4047
return set_instance_attr
4148

4249

@@ -46,18 +53,22 @@ def set_class_attr(cls, name, value):
4653
set(cls, name, value)
4754
else:
4855
raise AttributeError("You cannot add class attributes to %s" % cls)
56+
4957
return set_class_attr
5058

5159

5260
def _swig_add_metaclass(metaclass):
5361
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
62+
5463
def wrapper(cls):
5564
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
65+
5666
return wrapper
5767

5868

5969
class _SwigNonDynamicMeta(type):
6070
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
71+
6172
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
6273

6374

@@ -78,42 +89,83 @@ class _SwigNonDynamicMeta(type):
7889
WS2812_STRIP = _rpi_ws281x.WS2812_STRIP
7990
SK6812_STRIP = _rpi_ws281x.SK6812_STRIP
8091
SK6812W_STRIP = _rpi_ws281x.SK6812W_STRIP
92+
93+
8194
class ws2811_channel_t(object):
82-
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
95+
thisown = property(
96+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
97+
)
8398
__repr__ = _swig_repr
84-
gpionum = property(_rpi_ws281x.ws2811_channel_t_gpionum_get, _rpi_ws281x.ws2811_channel_t_gpionum_set)
85-
invert = property(_rpi_ws281x.ws2811_channel_t_invert_get, _rpi_ws281x.ws2811_channel_t_invert_set)
86-
count = property(_rpi_ws281x.ws2811_channel_t_count_get, _rpi_ws281x.ws2811_channel_t_count_set)
87-
strip_type = property(_rpi_ws281x.ws2811_channel_t_strip_type_get, _rpi_ws281x.ws2811_channel_t_strip_type_set)
88-
leds = property(_rpi_ws281x.ws2811_channel_t_leds_get, _rpi_ws281x.ws2811_channel_t_leds_set)
89-
brightness = property(_rpi_ws281x.ws2811_channel_t_brightness_get, _rpi_ws281x.ws2811_channel_t_brightness_set)
90-
wshift = property(_rpi_ws281x.ws2811_channel_t_wshift_get, _rpi_ws281x.ws2811_channel_t_wshift_set)
91-
rshift = property(_rpi_ws281x.ws2811_channel_t_rshift_get, _rpi_ws281x.ws2811_channel_t_rshift_set)
92-
gshift = property(_rpi_ws281x.ws2811_channel_t_gshift_get, _rpi_ws281x.ws2811_channel_t_gshift_set)
93-
bshift = property(_rpi_ws281x.ws2811_channel_t_bshift_get, _rpi_ws281x.ws2811_channel_t_bshift_set)
94-
gamma = property(_rpi_ws281x.ws2811_channel_t_gamma_get, _rpi_ws281x.ws2811_channel_t_gamma_set)
99+
gpionum = property(
100+
_rpi_ws281x.ws2811_channel_t_gpionum_get,
101+
_rpi_ws281x.ws2811_channel_t_gpionum_set,
102+
)
103+
invert = property(
104+
_rpi_ws281x.ws2811_channel_t_invert_get, _rpi_ws281x.ws2811_channel_t_invert_set
105+
)
106+
count = property(
107+
_rpi_ws281x.ws2811_channel_t_count_get, _rpi_ws281x.ws2811_channel_t_count_set
108+
)
109+
strip_type = property(
110+
_rpi_ws281x.ws2811_channel_t_strip_type_get,
111+
_rpi_ws281x.ws2811_channel_t_strip_type_set,
112+
)
113+
leds = property(
114+
_rpi_ws281x.ws2811_channel_t_leds_get, _rpi_ws281x.ws2811_channel_t_leds_set
115+
)
116+
brightness = property(
117+
_rpi_ws281x.ws2811_channel_t_brightness_get,
118+
_rpi_ws281x.ws2811_channel_t_brightness_set,
119+
)
120+
wshift = property(
121+
_rpi_ws281x.ws2811_channel_t_wshift_get, _rpi_ws281x.ws2811_channel_t_wshift_set
122+
)
123+
rshift = property(
124+
_rpi_ws281x.ws2811_channel_t_rshift_get, _rpi_ws281x.ws2811_channel_t_rshift_set
125+
)
126+
gshift = property(
127+
_rpi_ws281x.ws2811_channel_t_gshift_get, _rpi_ws281x.ws2811_channel_t_gshift_set
128+
)
129+
bshift = property(
130+
_rpi_ws281x.ws2811_channel_t_bshift_get, _rpi_ws281x.ws2811_channel_t_bshift_set
131+
)
132+
gamma = property(
133+
_rpi_ws281x.ws2811_channel_t_gamma_get, _rpi_ws281x.ws2811_channel_t_gamma_set
134+
)
95135

96136
def __init__(self):
97137
_rpi_ws281x.ws2811_channel_t_swiginit(self, _rpi_ws281x.new_ws2811_channel_t())
138+
98139
__swig_destroy__ = _rpi_ws281x.delete_ws2811_channel_t
99140

141+
100142
# Register ws2811_channel_t in _rpi_ws281x:
101143
_rpi_ws281x.ws2811_channel_t_swigregister(ws2811_channel_t)
102144

145+
103146
class ws2811_t(object):
104-
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
147+
thisown = property(
148+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
149+
)
105150
__repr__ = _swig_repr
106-
render_wait_time = property(_rpi_ws281x.ws2811_t_render_wait_time_get, _rpi_ws281x.ws2811_t_render_wait_time_set)
151+
render_wait_time = property(
152+
_rpi_ws281x.ws2811_t_render_wait_time_get,
153+
_rpi_ws281x.ws2811_t_render_wait_time_set,
154+
)
107155
device = property(_rpi_ws281x.ws2811_t_device_get, _rpi_ws281x.ws2811_t_device_set)
108156
rpi_hw = property(_rpi_ws281x.ws2811_t_rpi_hw_get, _rpi_ws281x.ws2811_t_rpi_hw_set)
109157
freq = property(_rpi_ws281x.ws2811_t_freq_get, _rpi_ws281x.ws2811_t_freq_set)
110158
dmanum = property(_rpi_ws281x.ws2811_t_dmanum_get, _rpi_ws281x.ws2811_t_dmanum_set)
111-
channel = property(_rpi_ws281x.ws2811_t_channel_get, _rpi_ws281x.ws2811_t_channel_set)
159+
channel = property(
160+
_rpi_ws281x.ws2811_t_channel_get, _rpi_ws281x.ws2811_t_channel_set
161+
)
112162

113163
def __init__(self):
114164
_rpi_ws281x.ws2811_t_swiginit(self, _rpi_ws281x.new_ws2811_t())
165+
115166
__swig_destroy__ = _rpi_ws281x.delete_ws2811_t
116167

168+
117169
# Register ws2811_t in _rpi_ws281x:
118170
_rpi_ws281x.ws2811_t_swigregister(ws2811_t)
119171

@@ -134,31 +186,38 @@ def __init__(self):
134186
WS2811_ERROR_SPI_TRANSFER = _rpi_ws281x.WS2811_ERROR_SPI_TRANSFER
135187
WS2811_RETURN_STATE_COUNT = _rpi_ws281x.WS2811_RETURN_STATE_COUNT
136188

189+
137190
def ws2811_init(ws2811):
138191
return _rpi_ws281x.ws2811_init(ws2811)
139192

193+
140194
def ws2811_fini(ws2811):
141195
return _rpi_ws281x.ws2811_fini(ws2811)
142196

197+
143198
def ws2811_render(ws2811):
144199
return _rpi_ws281x.ws2811_render(ws2811)
145200

201+
146202
def ws2811_wait(ws2811):
147203
return _rpi_ws281x.ws2811_wait(ws2811)
148204

205+
149206
def ws2811_get_return_t_str(state):
150207
return _rpi_ws281x.ws2811_get_return_t_str(state)
151208

209+
152210
def ws2811_set_custom_gamma_factor(ws2811, gamma_factor):
153211
return _rpi_ws281x.ws2811_set_custom_gamma_factor(ws2811, gamma_factor)
154212

213+
155214
def ws2811_led_get(channel, lednum):
156215
return _rpi_ws281x.ws2811_led_get(channel, lednum)
157216

217+
158218
def ws2811_led_set(channel, lednum, color):
159219
return _rpi_ws281x.ws2811_led_set(channel, lednum, color)
160220

221+
161222
def ws2811_channel_get(ws, channelnum):
162223
return _rpi_ws281x.ws2811_channel_get(ws, channelnum)
163-
164-

0 commit comments

Comments
 (0)