mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	utils/types: Add add method to toggle_set
				
					
				
			Allows adding of elements that will respect the state of an existing element in the toggle set.
This commit is contained in:
		@@ -389,6 +389,16 @@ class toggle_set(set):
 | 
			
		||||
        other = copy(other)
 | 
			
		||||
        return toggle_set.merge(self, other)
 | 
			
		||||
 | 
			
		||||
    def add(self, item):
 | 
			
		||||
        if item not in self:
 | 
			
		||||
            #Disable previously enabled item
 | 
			
		||||
            if item.startswith('~') and item[1:] in self:
 | 
			
		||||
                self.remove(item[1:])
 | 
			
		||||
            #Enable previously disabled item
 | 
			
		||||
            if not item.startswith('~') and ('~' + item) in self:
 | 
			
		||||
                self.remove('~' + item)
 | 
			
		||||
            super(toggle_set, self).add(item)
 | 
			
		||||
 | 
			
		||||
    def values(self):
 | 
			
		||||
        """
 | 
			
		||||
        returns a list of enabled items.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user