mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Change CompositeDevice to reject invalid identifiers
Also updated StatusBoard and StatusZero to reject duplicate identifiers (namedtuple doesn't pick 'em up because they're passed in a dict and thus the dups are squashed prior to the call). Added tests for all the relevant stuff.
This commit is contained in:
		| @@ -330,8 +330,7 @@ class CompositeDevice(Device): | ||||
|                 raise CompositeDeviceBadDevice("%s doesn't inherit from Device" % dev) | ||||
|         self._named = frozendict(kwargs) | ||||
|         self._namedtuple = namedtuple('%sValue' % self.__class__.__name__, chain( | ||||
|             (str(i) for i in range(len(args))), self._order), | ||||
|             rename=True) | ||||
|             ('device_%d' % i for i in range(len(args))), self._order)) | ||||
|  | ||||
|     def __getattr__(self, name): | ||||
|         # if _named doesn't exist yet, pretend it's an empty dict | ||||
|   | ||||
		Reference in New Issue
	
	Block a user