Skip to content

Commit

Permalink
removed future dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mathandy committed Aug 22, 2018
1 parent 360d6b2 commit 3d1a225
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def read(*parts):
# download_url = 'http://github.com/mathandy/svgpathtools/tarball/'+VERSION,
license='MIT',

install_requires=['numpy', 'svgwrite', 'future'],
install_requires=['numpy', 'svgwrite'],
platforms="OS Independent",
# test_suite='tests',
requires=['numpy', 'svgwrite', 'future'],
requires=['numpy', 'svgwrite'],
keywords=['svg', 'svg path', 'svg.path', 'bezier', 'parse svg path', 'display svg'],
classifiers = [
"Development Status :: 4 - Beta",
Expand Down
14 changes: 8 additions & 6 deletions svgpathtools/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@
from .path import *

# To maintain forward/backward compatibility
from past.builtins import basestring
from future.utils import iteritems
try:
str = basestring
except NameError:
pass

# Let xml.etree.ElementTree know about the SVG namespace
SVG_NAMESPACE = {'svg': 'http://www.w3.org/2000/svg'}
Expand Down Expand Up @@ -120,7 +122,7 @@ def get_relevant_children(parent, last_tf):

# For each element type that we know how to convert into path data, parse the element after confirming that
# 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)):
path_tf = top.transform.dot(parse_transform(path_elem.get('transform')))
path = transform(parse_path(converter(path_elem)), path_tf)
Expand Down Expand Up @@ -206,7 +208,7 @@ def flatten_group(self,
group_filter=lambda x: True,
path_filter=lambda x: True,
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
group = self.get_or_add_group(group)
elif not isinstance(group, Element):
Expand All @@ -223,7 +225,7 @@ def add_path(self, path, attribs=None, group=None):
group = self.tree.getroot()

# 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)

elif not isinstance(group, Element):
Expand All @@ -240,7 +242,7 @@ def add_path(self, path, attribs=None, group=None):
path_svg = path.d()
elif is_path_segment(path):
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?
path_svg = path
else:
Expand Down
7 changes: 5 additions & 2 deletions svgpathtools/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from .path import Path, Line, QuadraticBezier, CubicBezier, Arc

# To maintain forward/backward compatibility
from past.builtins import basestring
try:
str = basestring
except NameError:
pass

COMMANDS = set('MmZzLlHhVvCcSsQqTtAa')
UPPERCASE = set('MZLHVCSQTA')
Expand Down Expand Up @@ -286,7 +289,7 @@ def parse_transform(transform_str):
If the string is empty or null, this returns a 3x3 identity matrix"""
if not transform_str:
return np.identity(3)
elif not isinstance(transform_str, basestring):
elif not isinstance(transform_str, str):
raise TypeError('Must provide a string to parse')

total_transform = np.identity(3)
Expand Down

0 comments on commit 3d1a225

Please sign in to comment.