forked from lesscpy/lesscpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
18 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,10 @@ | |
.. moduleauthor:: Johann T. Mariusson <[email protected]> | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
import tempfile | ||
import sys | ||
import ply.yacc | ||
from six import string_types | ||
|
||
from . import lexer | ||
from . import utility | ||
|
@@ -234,7 +231,7 @@ def p_statement_import(self, p): | |
if self.importlvl > 8: | ||
raise ImportError( | ||
'Recrusive import level too deep > 8 (circular import ?)') | ||
if isinstance(p[3], string_types): | ||
if isinstance(p[3], str): | ||
ipath = utility.destring(p[3]) | ||
elif isinstance(p[3], list): | ||
p[3] = Import(p[3], p.lineno(4)).parse(self.scope) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ | |
See LICENSE for details. | ||
.. moduleauthor:: Johann T. Mariusson <[email protected]> | ||
""" | ||
from six import string_types | ||
|
||
from . import utility | ||
|
||
|
||
|
@@ -190,7 +188,7 @@ def swap(self, name): | |
var = self.variables('@' + name[2:-1]) | ||
if var is False: | ||
raise SyntaxError('Unknown escaped variable %s' % name) | ||
if isinstance(var.value[0], string_types): | ||
if isinstance(var.value[0], str): | ||
var.value[0] = utility.destring(var.value[0]) | ||
else: | ||
var = self.variables(name) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,10 @@ | |
.. moduleauthor:: Johann T. Mariusson <[email protected]> | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
import itertools | ||
import math | ||
import re | ||
import sys | ||
from six import string_types | ||
|
||
try: | ||
from collections.abc import Iterable | ||
|
@@ -30,8 +27,7 @@ def flatten(lst): | |
generator | ||
""" | ||
for elm in lst: | ||
if isinstance(elm, Iterable) and not isinstance( | ||
elm, string_types): | ||
if isinstance(elm, Iterable) and not isinstance(elm, str): | ||
for sub in flatten(elm): | ||
yield sub | ||
else: | ||
|
@@ -138,7 +134,7 @@ def analyze_number(var, err=''): | |
tuple | ||
""" | ||
n, u = split_unit(var) | ||
if not isinstance(var, string_types): | ||
if not isinstance(var, str): | ||
return var, u | ||
if is_color(var): | ||
return var, 'color' | ||
|
@@ -168,7 +164,7 @@ def with_unit(number, unit=None): | |
if number.startswith('.'): | ||
number = '0' + number | ||
return "%s%s" % (number, unit) | ||
return number if isinstance(number, string_types) else str(number) | ||
return number if isinstance(number, str) else str(number) | ||
|
||
|
||
def is_color(value): | ||
|
@@ -178,7 +174,7 @@ def is_color(value): | |
returns: | ||
bool | ||
""" | ||
if not value or not isinstance(value, string_types): | ||
if not value or not isinstance(value, str): | ||
return False | ||
if value[0] == '#' and len(value) in [4, 5, 7, 9]: | ||
try: | ||
|
@@ -196,7 +192,7 @@ def is_variable(value): | |
returns: | ||
bool | ||
""" | ||
if isinstance(value, string_types): | ||
if isinstance(value, str): | ||
return value.startswith('@') or value.startswith('-@') | ||
elif isinstance(value, tuple): | ||
value = ''.join(value) | ||
|
@@ -287,7 +283,7 @@ def pc_or_float(s): | |
returns: | ||
float | ||
""" | ||
if isinstance(s, string_types) and '%' in s: | ||
if isinstance(s, str) and '%' in s: | ||
return float(s.strip('%')) / 100.0 | ||
return float(s) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
""" | ||
import unittest | ||
|
||
from six import StringIO | ||
from io import StringIO | ||
|
||
from lesscpy import compile | ||
|
||
|