summaryrefslogtreecommitdiff
path: root/scss/types.py
diff options
context:
space:
mode:
Diffstat (limited to 'scss/types.py')
-rw-r--r--scss/types.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/scss/types.py b/scss/types.py
index 889cf49..e8d3226 100644
--- a/scss/types.py
+++ b/scss/types.py
@@ -112,6 +112,9 @@ class Null(Value):
def __repr__(self):
return "<%s>" % (type(self).__name__,)
+ def __hash__(self):
+ return hash(None)
+
def __bool__(self):
return False
@@ -131,6 +134,9 @@ class BooleanValue(Value):
def __str__(self):
return 'true' if self.value else 'false'
+ def __hash__(self):
+ return hash(self.value)
+
def __bool__(self):
return self.value
@@ -200,6 +206,9 @@ class NumberValue(Value):
return '<%s: %r%s>' % (self.__class__.__name__, self.value, full_unit)
+ def __hash__(self):
+ return hash((self.value, self.unit_numer, self.unit_denom))
+
def __int__(self):
return int(self.value)
@@ -465,9 +474,8 @@ class List(Value):
return cls(args, use_comma=use_comma)
- @property
- def separator(self):
- return self.value.get('_', '')
+ def __hash__(self):
+ return hash((self.value, self.use_comma))
def delimiter(self, compress=False):
if self.use_comma:
@@ -642,6 +650,9 @@ class ColorValue(Value):
def __repr__(self):
return '<%s: %s, %s>' % (self.__class__.__name__, repr(self.value), repr(self.types))
+ def __hash__(self):
+ return hash(self.value)
+
def __str__(self):
# TODO bit of a hack?
if self.tokens is not None and isinstance(self.tokens, ParserValue):
@@ -785,6 +796,9 @@ class String(Value):
self.value = value.encode('ascii')
self.quotes = quotes
+ def __hash__(self):
+ return hash(self.value)
+
def __str__(self):
if self.quotes:
return self.quotes + escape(self.value) + self.quotes