summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2013-08-09 15:10:53 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2013-08-09 15:10:53 -0700
commit94b0e49bdf14b9637ffac6a40ded6cf19f7a3df1 (patch)
tree1b13b331e2eb9a125185307dc669f4432bd926c2
parenta6e8371d3afc36bed7692577e91015306e2d3e37 (diff)
downloadpyscss-94b0e49bdf14b9637ffac6a40ded6cf19f7a3df1.tar.gz
Restore __hash__ on types.
-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