summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-12-23 11:48:17 -0500
committerCasey Dahlin <cdahlin@redhat.com>2008-12-23 11:48:17 -0500
commitde2f7051649b01978bc02d105400548dcb4a7e4d (patch)
tree800bc9a9031ec867b7403e6f3f921a9ba37b72fc
parentf5b2fc6b601036b529e5c18d860e92c5ba467277 (diff)
downloadupstate-de2f7051649b01978bc02d105400548dcb4a7e4d.tar.gz
upstate-de2f7051649b01978bc02d105400548dcb4a7e4d.tar.xz
upstate-de2f7051649b01978bc02d105400548dcb4a7e4d.zip
Add full() method to pattern
-rw-r--r--pattern.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pattern.py b/pattern.py
index 7ff95d8..6b391ad 100644
--- a/pattern.py
+++ b/pattern.py
@@ -31,6 +31,12 @@ class Pattern:
if len(self.items) > 0: return True
return False
+ def full(self):
+ """
+ Returns True if this pattern matches *all* strings.
+ """
+ return self.invert and len(self.items) == 0
+
def singular(self):
"""
Returns True if this pattern will match *exactly one* string