This finishes off implementing values and source for all (current)
classes in gpiozero. I'm afraid things get rather complex in this
commit. For starters, we've now got quite a few "aggregate" classes
which necessarily don't descend from GPIODevice. To implement values and
source on these I could either repeat a helluva lot of code or ... turn
to mixin classes. Yeah, it's multiple inheritance time, baby!

Unfortunately multiple inheritance doesn't work with __slots__ but we
really ought to keep functionality that they provide us (raise
AttributeError when an unknown attribute is set). So I've implemented
this with ... erm ... metaclasses. Sorry!
This commit is contained in:
Dave Jones
2015-10-19 13:36:31 +01:00
parent b0b54162cc
commit fa0a1b3cdd
5 changed files with 403 additions and 239 deletions

View File

@@ -1,6 +1,12 @@
from __future__ import absolute_import
from __future__ import (
unicode_literals,
print_function,
absolute_import,
division,
)
from .devices import (
GPIODeviceClosed,
GPIODeviceError,
GPIODevice,
)
@@ -16,6 +22,7 @@ from .input_devices import (
MCP3004,
)
from .output_devices import (
OutputDeviceError,
OutputDevice,
PWMOutputDevice,
PWMLED,