Some Python-3 compatibility fixes
This commit is contained in:
@@ -2,7 +2,7 @@ language: python
|
||||
python:
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
#- "3.3"
|
||||
- "3.3"
|
||||
# command to install dependencies
|
||||
install: "pip install -r requirements.txt --use-mirrors"
|
||||
# command to run tests
|
||||
|
||||
@@ -62,7 +62,7 @@ class Color():
|
||||
return self.rgba(*args)
|
||||
elif len(args) == 3:
|
||||
try:
|
||||
return self._rgbatohex(map(int, args))
|
||||
return self._rgbatohex(list(map(int, args)))
|
||||
except ValueError:
|
||||
if all((a for a in args
|
||||
if a[-1] == '%'
|
||||
@@ -80,7 +80,7 @@ class Color():
|
||||
"""
|
||||
if len(args) == 4:
|
||||
try:
|
||||
return self._rgbatohex(map(int, args))
|
||||
return self._rgbatohex(list(map(int, args)))
|
||||
except ValueError:
|
||||
if all((a for a in args
|
||||
if a[-1] == '%'
|
||||
|
||||
@@ -84,7 +84,7 @@ class LessLexer:
|
||||
def __init__(self):
|
||||
self.build(reflags=re.UNICODE | re.IGNORECASE)
|
||||
self.last = None
|
||||
self.next = None
|
||||
self.next_ = None
|
||||
self.pretok = True
|
||||
|
||||
def t_css_filter(self, t):
|
||||
@@ -256,9 +256,9 @@ class LessLexer:
|
||||
2. Strips out whitespace from nonsignificant locations
|
||||
to ease parsing.
|
||||
"""
|
||||
if self.next:
|
||||
t = self.next
|
||||
self.next = None
|
||||
if self.next_:
|
||||
t = self.next_
|
||||
self.next_ = None
|
||||
return t
|
||||
while True:
|
||||
t = self.lexer.token()
|
||||
@@ -270,7 +270,7 @@ class LessLexer:
|
||||
continue
|
||||
self.pretok = False
|
||||
if t.type == '}' and self.last and self.last.type not in '{;}':
|
||||
self.next = t
|
||||
self.next_ = t
|
||||
tok = lex.LexToken()
|
||||
tok.type = ';'
|
||||
tok.value = ';'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
# -*- coding: utf8 -*-
|
||||
"""
|
||||
.. module:: lesscpy.lessc.parser
|
||||
@@ -12,9 +11,13 @@ from __future__ import print_function
|
||||
See LICENSE for details.
|
||||
.. moduleauthor:: Johann T. Mariusson <jtm@robot.is>
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ply.yacc
|
||||
|
||||
from . import lexer
|
||||
from . import utility
|
||||
from .scope import Scope
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
See LICENSE for details.
|
||||
.. moduleauthor:: Johann T. Mariusson <jtm@robot.is>
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import collections
|
||||
import re
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class Mixin(Node):
|
||||
raises:
|
||||
SyntaxError
|
||||
"""
|
||||
arguments = zip(args, [' '] * len(args)) if args and args[0] else None
|
||||
arguments = list(zip(args, [' '] * len(args))) if args and args[0] else None
|
||||
zl = itertools.zip_longest if sys.version_info[
|
||||
0] == 3 else itertools.izip_longest
|
||||
if self.args:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
# -*- coding: utf8 -*-
|
||||
"""
|
||||
.. module:: lesscpy.scripts.compiler
|
||||
@@ -10,11 +9,15 @@ from __future__ import print_function
|
||||
See LICENSE for details
|
||||
.. moduleauthor:: Johann T. Mariusson <jtm@robot.is>
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import copy
|
||||
import argparse
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
||||
from lesscpy.lessc import parser
|
||||
from lesscpy.lessc import lexer
|
||||
|
||||
Reference in New Issue
Block a user