removed future dependencies
parent
360d6b224c
commit
3d1a225503
4
setup.py
4
setup.py
|
@ -31,10 +31,10 @@ setup(name='svgpathtools',
|
||||||
# download_url = 'http://github.com/mathandy/svgpathtools/tarball/'+VERSION,
|
# download_url = 'http://github.com/mathandy/svgpathtools/tarball/'+VERSION,
|
||||||
license='MIT',
|
license='MIT',
|
||||||
|
|
||||||
install_requires=['numpy', 'svgwrite', 'future'],
|
install_requires=['numpy', 'svgwrite'],
|
||||||
platforms="OS Independent",
|
platforms="OS Independent",
|
||||||
# test_suite='tests',
|
# test_suite='tests',
|
||||||
requires=['numpy', 'svgwrite', 'future'],
|
requires=['numpy', 'svgwrite'],
|
||||||
keywords=['svg', 'svg path', 'svg.path', 'bezier', 'parse svg path', 'display svg'],
|
keywords=['svg', 'svg path', 'svg.path', 'bezier', 'parse svg path', 'display svg'],
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
|
|
|
@ -50,8 +50,10 @@ from .misctools import open_in_browser
|
||||||
from .path import *
|
from .path import *
|
||||||
|
|
||||||
# To maintain forward/backward compatibility
|
# To maintain forward/backward compatibility
|
||||||
from past.builtins import basestring
|
try:
|
||||||
from future.utils import iteritems
|
str = basestring
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Let xml.etree.ElementTree know about the SVG namespace
|
# Let xml.etree.ElementTree know about the SVG namespace
|
||||||
SVG_NAMESPACE = {'svg': 'http://www.w3.org/2000/svg'}
|
SVG_NAMESPACE = {'svg': 'http://www.w3.org/2000/svg'}
|
||||||
|
@ -120,7 +122,7 @@ def flatten_all_paths(
|
||||||
|
|
||||||
# For each element type that we know how to convert into path data, parse the element after confirming that
|
# For each element type that we know how to convert into path data, parse the element after confirming that
|
||||||
# the path_filter accepts it.
|
# the path_filter accepts it.
|
||||||
for key, converter in iteritems(path_conversions):
|
for key, converter in path_conversions.items():
|
||||||
for path_elem in filter(path_filter, top.group.iterfind('svg:'+key, SVG_NAMESPACE)):
|
for path_elem in filter(path_filter, top.group.iterfind('svg:'+key, SVG_NAMESPACE)):
|
||||||
path_tf = top.transform.dot(parse_transform(path_elem.get('transform')))
|
path_tf = top.transform.dot(parse_transform(path_elem.get('transform')))
|
||||||
path = transform(parse_path(converter(path_elem)), path_tf)
|
path = transform(parse_path(converter(path_elem)), path_tf)
|
||||||
|
@ -206,7 +208,7 @@ class Document:
|
||||||
group_filter=lambda x: True,
|
group_filter=lambda x: True,
|
||||||
path_filter=lambda x: True,
|
path_filter=lambda x: True,
|
||||||
path_conversions=CONVERSIONS):
|
path_conversions=CONVERSIONS):
|
||||||
if all(isinstance(s, basestring) for s in group):
|
if all(isinstance(s, str) for s in group):
|
||||||
# If we're given a list of strings, assume it represents a nested sequence
|
# If we're given a list of strings, assume it represents a nested sequence
|
||||||
group = self.get_or_add_group(group)
|
group = self.get_or_add_group(group)
|
||||||
elif not isinstance(group, Element):
|
elif not isinstance(group, Element):
|
||||||
|
@ -223,7 +225,7 @@ class Document:
|
||||||
group = self.tree.getroot()
|
group = self.tree.getroot()
|
||||||
|
|
||||||
# If we are given a list of strings (one or more), assume it represents a sequence of nested group names
|
# If we are given a list of strings (one or more), assume it represents a sequence of nested group names
|
||||||
elif all(isinstance(elem, basestring) for elem in group):
|
elif all(isinstance(elem, str) for elem in group):
|
||||||
group = self.get_or_add_group(group)
|
group = self.get_or_add_group(group)
|
||||||
|
|
||||||
elif not isinstance(group, Element):
|
elif not isinstance(group, Element):
|
||||||
|
@ -240,7 +242,7 @@ class Document:
|
||||||
path_svg = path.d()
|
path_svg = path.d()
|
||||||
elif is_path_segment(path):
|
elif is_path_segment(path):
|
||||||
path_svg = Path(path).d()
|
path_svg = Path(path).d()
|
||||||
elif isinstance(path, basestring):
|
elif isinstance(path, str):
|
||||||
# Assume this is a valid d-string. TODO: Should we sanity check the input string?
|
# Assume this is a valid d-string. TODO: Should we sanity check the input string?
|
||||||
path_svg = path
|
path_svg = path
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -12,7 +12,10 @@ import warnings
|
||||||
from .path import Path, Line, QuadraticBezier, CubicBezier, Arc
|
from .path import Path, Line, QuadraticBezier, CubicBezier, Arc
|
||||||
|
|
||||||
# To maintain forward/backward compatibility
|
# To maintain forward/backward compatibility
|
||||||
from past.builtins import basestring
|
try:
|
||||||
|
str = basestring
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
|
||||||
COMMANDS = set('MmZzLlHhVvCcSsQqTtAa')
|
COMMANDS = set('MmZzLlHhVvCcSsQqTtAa')
|
||||||
UPPERCASE = set('MZLHVCSQTA')
|
UPPERCASE = set('MZLHVCSQTA')
|
||||||
|
@ -286,7 +289,7 @@ def parse_transform(transform_str):
|
||||||
If the string is empty or null, this returns a 3x3 identity matrix"""
|
If the string is empty or null, this returns a 3x3 identity matrix"""
|
||||||
if not transform_str:
|
if not transform_str:
|
||||||
return np.identity(3)
|
return np.identity(3)
|
||||||
elif not isinstance(transform_str, basestring):
|
elif not isinstance(transform_str, str):
|
||||||
raise TypeError('Must provide a string to parse')
|
raise TypeError('Must provide a string to parse')
|
||||||
|
|
||||||
total_transform = np.identity(3)
|
total_transform = np.identity(3)
|
||||||
|
|
Loading…
Reference in New Issue