Commits

Pior Bastida committed d5c5e06

subclassed awstools.Applications from collections.Set

  • Participants
  • Parent commits 5d47bd1

Comments (0)

Files changed (1)

awstools/application.py

         return stack_prop
 
 
-class Applications(object):
+class Applications(collections.Set):
     """
     Collection of Application
     """
         if yamldata:
             self.load_from_yaml(yamldata)
 
+    def __iter__(self):
+        return iter(self._apps)
+
+    def __contains__(self, value):
+        return value in self._apps
+
+    def __len__(self):
+        return len(self._apps)
+
     def __str__(self):
         return pprint.pformat(self._apps)
 
 
         self._apps = [Application(d) for d in docs]
 
-        for app in self._apps:
+        for app in self:
             app.apply_model(self)
             app.validate()
 
         if stackname:
             shortname = stackname.split('-')[0]
 
-        for app in self._apps:
+        for app in self:
             if name and app.name != name:
                 continue
             if shortname and app.shortname != shortname: