mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Merge pull request #341 from lurch/deprecate_CompositeDevice_all
remove usage of CompositeDevice.all since it's marked as deprecated
This commit is contained in:
		@@ -52,7 +52,7 @@ class CompositeOutputDevice(SourceMixin, CompositeDevice):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        Turn all the output devices on.
 | 
					        Turn all the output devices on.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        for device in self.all:
 | 
					        for device in self:
 | 
				
			||||||
            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
					            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
				
			||||||
                device.on()
 | 
					                device.on()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -60,7 +60,7 @@ class CompositeOutputDevice(SourceMixin, CompositeDevice):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        Turn all the output devices off.
 | 
					        Turn all the output devices off.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        for device in self.all:
 | 
					        for device in self:
 | 
				
			||||||
            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
					            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
				
			||||||
                device.off()
 | 
					                device.off()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,7 +69,7 @@ class CompositeOutputDevice(SourceMixin, CompositeDevice):
 | 
				
			|||||||
        Toggle all the output devices. For each device, if it's on, turn it
 | 
					        Toggle all the output devices. For each device, if it's on, turn it
 | 
				
			||||||
        off; if it's off, turn it on.
 | 
					        off; if it's off, turn it on.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        for device in self.all:
 | 
					        for device in self:
 | 
				
			||||||
            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
					            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
				
			||||||
                device.toggle()
 | 
					                device.toggle()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,7 +83,7 @@ class CompositeOutputDevice(SourceMixin, CompositeDevice):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @value.setter
 | 
					    @value.setter
 | 
				
			||||||
    def value(self, value):
 | 
					    def value(self, value):
 | 
				
			||||||
        for device, v in zip(self.all, value):
 | 
					        for device, v in zip(self, value):
 | 
				
			||||||
            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
					            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
 | 
				
			||||||
                device.value = v
 | 
					                device.value = v
 | 
				
			||||||
            # Simply ignore values for non-output devices
 | 
					            # Simply ignore values for non-output devices
 | 
				
			||||||
@@ -915,7 +915,7 @@ class _EnergenieMaster(SharedMixin, CompositeOutputDevice):
 | 
				
			|||||||
        with self._lock:
 | 
					        with self._lock:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                code = (8 * bool(enable)) + (8 - socket)
 | 
					                code = (8 * bool(enable)) + (8 - socket)
 | 
				
			||||||
                for bit in self.all[:4]:
 | 
					                for bit in self[:4]:
 | 
				
			||||||
                    bit.value = (code & 1)
 | 
					                    bit.value = (code & 1)
 | 
				
			||||||
                    code >>= 1
 | 
					                    code >>= 1
 | 
				
			||||||
                sleep(0.1)
 | 
					                sleep(0.1)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user