1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
Description: Fixups for Python 3.2 compat
Uses six.u() whenever needed
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2014-06-27
--- python-pyscss-1.2.0.post3.orig/scss/expression.py
+++ python-pyscss-1.2.0.post3/scss/expression.py
@@ -326,7 +326,7 @@ class CallOp(Expression):
rendered_args = [arg.render() for arg in args]
return String(
- u"%s(%s)" % (func_name, u", ".join(rendered_args)),
+ six.u("%s(%s)") % (func_name, six.u(", ").join(rendered_args)),
quotes=None)
--- python-pyscss-1.2.0.post3.orig/scss/types.py
+++ python-pyscss-1.2.0.post3/scss/types.py
@@ -16,7 +16,7 @@ from scss.util import escape
class Value(object):
is_null = False
- sass_type_name = u'unknown'
+ sass_type_name = six.u('unknown')
def __repr__(self):
return '<%s(%s)>' % (self.__class__.__name__, repr(self.value))
@@ -123,7 +123,7 @@ class Value(object):
class Null(Value):
is_null = True
- sass_type_name = u'null'
+ sass_type_name = six.u('null')
def __init__(self, value=None):
pass
@@ -151,7 +151,7 @@ class Null(Value):
class Undefined(Null):
- sass_type_name = u'undefined'
+ sass_type_name = six.u('undefined')
def __init__(self, value=None):
pass
@@ -200,7 +200,7 @@ class Undefined(Null):
class Boolean(Value):
- sass_type_name = u'bool'
+ sass_type_name = six.u('bool')
def __init__(self, value):
self.value = bool(value)
@@ -222,7 +222,7 @@ class Boolean(Value):
class Number(Value):
- sass_type_name = u'number'
+ sass_type_name = six.u('number')
def __init__(self, amount, unit=None, unit_numer=(), unit_denom=()):
if isinstance(amount, Number):
@@ -547,7 +547,7 @@ class List(Value):
in CSS output.
"""
- sass_type_name = u'list'
+ sass_type_name = six.u('list')
def __init__(self, iterable, separator=None, use_comma=None, is_literal=False):
if isinstance(iterable, List):
@@ -733,7 +733,7 @@ def _constrain(value, lb=0, ub=1):
class Color(Value):
- sass_type_name = u'color'
+ sass_type_name = six.u('color')
original_literal = None
def __init__(self, tokens):
@@ -976,7 +976,7 @@ class String(Value):
Otherwise, double quotes are used.
"""
- sass_type_name = u'string'
+ sass_type_name = six.u('string')
def __init__(self, value, quotes='"'):
if isinstance(value, String):
@@ -1058,7 +1058,7 @@ class String(Value):
class Map(Value):
- sass_type_name = u'map'
+ sass_type_name = six.u('map')
def __init__(self, pairs, index=None):
self.pairs = tuple(pairs)
@@ -1112,10 +1112,10 @@ def expect_type(value, types, unit=any):
if len(sass_type_names) == 1:
sass_type = sass_type_names[0]
elif len(sass_type_names) == 2:
- sass_type = u' or '.join(sass_type_names)
+ sass_type = six.u(' or ').join(sass_type_names)
else:
- sass_type = u', '.join(sass_type_names[:-1])
- sass_type += u', or ' + sass_type_names[-1]
+ sass_type = six.u(', ').join(sass_type_names[:-1])
+ sass_type += six.u(', or ') + sass_type_names[-1]
raise TypeError("Expected %s, got %r" % (sass_type, value))
--- python-pyscss-1.2.0.post3.orig/scss/functions/core.py
+++ python-pyscss-1.2.0.post3/scss/functions/core.py
@@ -8,6 +8,8 @@ from __future__ import division
import logging
import math
+import six
+
from six.moves import xrange
from scss.functions.library import FunctionLibrary
@@ -221,7 +223,7 @@ def lightness(color):
@register('ie-hex-str', 1)
def ie_hex_str(color):
c = Color(color).value
- return String(u'#%02X%02X%02X%02X' % (round(c[3] * 255), round(c[0]), round(c[1]), round(c[2])))
+ return String(six.u('#%02X%02X%02X%02X') % (round(c[3] * 255), round(c[0]), round(c[1]), round(c[2])))
# ------------------------------------------------------------------------------
|