[Bf-extensions-cvs] [788441f] master: svg addon: Cleanup: Use more pythonic idioms

jim man noreply at git.blender.org
Mon Jul 19 13:42:11 CEST 2021


Commit: 788441f2930465bbfba8f0797b12dcef1d46694d
Author: jim man
Date:   Mon Jul 19 21:40:32 2021 +1000
Branches: master
https://developer.blender.org/rBAC788441f2930465bbfba8f0797b12dcef1d46694d

svg addon: Cleanup: Use more pythonic idioms

Use python3 syntax + remove some unessessary variables

Reviewed By: campbellbarton

Ref D11961

===================================================================

M	io_vector/svg.py

===================================================================

diff --git a/io_vector/svg.py b/io_vector/svg.py
index ddb9b42..4a2012b 100644
--- a/io_vector/svg.py
+++ b/io_vector/svg.py
@@ -56,7 +56,7 @@ def ParseSVGString(s):
     return _SVGDomToArg(dom)
 
 
-class _SState(object):
+class _SState:
     """Holds state that affects the conversion.
     """
 
@@ -146,8 +146,8 @@ def _ProcessPolygon(node, art, gs):
     if node.hasAttribute('points'):
         coords = _ParseCoordPairList(node.getAttribute('points'))
         n = len(coords)
-        if n > 0:
-            c = [gs.ctm.Apply(coords[i]) for i in range(n)]
+        if coords:
+            c = [gs.ctm.Apply(coord) for coord in coords]
             sp = geom.Subpath()
             sp.segments = [('L', c[i], c[i % n]) for i in range(n)]
             sp.closed = True
@@ -172,7 +172,6 @@ def _ProcessPath(node, art, gs):
         return
     s = node.getAttribute('d')
     i = 0
-    n = len(s)
     path = geom.Path()
     _SetPathAttributes(path, node, gs)
     initpt = (0.0, 0.0)



More information about the Bf-extensions-cvs mailing list