def attributes(self):
return self._attributes.values()
- def get_attribute_list(self, filter_flags = None):
+ def get_attribute_list(self, filter_flags = None, exclude = False):
+ """
+ Returns the list of attributes.
+
+ Params:
+ filter_flags: if given, only attributes with (all) the specified
+ flags will be returned.
+
+ exclude: if True, only attributes without (any of) the specified
+ flags will be returned.
+ """
attributes = self._attributes
if filter_flags != None:
def filter_attrs(attr_data):
(attr_id, attr) = attr_data
- return attr.has_flag(filter_flags)
+ return attr.has_flag(filter_flags) == (not exclude)
attributes = dict(filter(filter_attrs, attributes.iteritems()))
return attributes.keys()
"""
raise NotImplementedError
- def get_attribute_list(self, guid, filter_flags = None):
+ def get_attribute_list(self, guid, filter_flags = None, exclude = False):
raise NotImplementedError
def get_factory_id(self, guid):
return addresses[index][attribute_index]
- def get_attribute_list(self, guid, filter_flags = None):
+ def get_attribute_list(self, guid, filter_flags = None, exclude = False):
factory = self._get_factory(guid)
attribute_list = list()
- return factory.box_attributes.get_attribute_list(filter_flags)
+ return factory.box_attributes.get_attribute_list(filter_flags, exclude)
def get_factory_id(self, guid):
factory = self._get_factory(guid)
return self._testbed.status(guid)
@Marshalling.handles(GET_ATTRIBUTE_LIST)
- @Marshalling.args(int, int)
+ @Marshalling.args(int, int, Marshalling.bool)
@Marshalling.retval( Marshalling.pickled_data )
- def get_attribute_list(self, guid, filter_flags = None):
- return self._testbed.get_attribute_list(guid, filter_flags)
+ def get_attribute_list(self, guid, filter_flags = None, exclude = False):
+ return self._testbed.get_attribute_list(guid, filter_flags, exclude)
@Marshalling.handles(GET_FACTORY_ID)
@Marshalling.args(int)