Coding style fixes master
authorAntonio Ospite <ao2@ao2.it>
Mon, 2 Jul 2018 12:57:13 +0000 (14:57 +0200)
committerAntonio Ospite <ao2@ao2.it>
Mon, 2 Jul 2018 12:57:13 +0000 (14:57 +0200)
svgwrite_inkscape_drawing.py

index b307544..78a3a4a 100755 (executable)
@@ -12,6 +12,9 @@ from svgwrite.data.types import SVGAttribute
 
 class InkscapeDrawing(svgwrite.Drawing):
     """An svgwrite.Drawing subclass which supports Inkscape layers"""
 
 class InkscapeDrawing(svgwrite.Drawing):
     """An svgwrite.Drawing subclass which supports Inkscape layers"""
+    INKSCAPE_NAMESPACE = 'http://www.inkscape.org/namespaces/inkscape'
+    SODIPODI_NAMESPACE = 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'
+
     def __init__(self, *args, **kwargs):
         super(InkscapeDrawing, self).__init__(*args, **kwargs)
 
     def __init__(self, *args, **kwargs):
         super(InkscapeDrawing, self).__init__(*args, **kwargs)
 
@@ -19,11 +22,11 @@ class InkscapeDrawing(svgwrite.Drawing):
             'xmlns:inkscape': SVGAttribute('xmlns:inkscape',
                                            anim=False,
                                            types=[],
             'xmlns:inkscape': SVGAttribute('xmlns:inkscape',
                                            anim=False,
                                            types=[],
-                                           const=frozenset(['http://www.inkscape.org/namespaces/inkscape'])),
+                                           const=frozenset([self.INKSCAPE_NAMESPACE])),
             'xmlns:sodipodi': SVGAttribute('xmlns:sodipodi',
                                            anim=False,
                                            types=[],
             'xmlns:sodipodi': SVGAttribute('xmlns:sodipodi',
                                            anim=False,
                                            types=[],
-                                           const=frozenset(['http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'])),
+                                           const=frozenset([self.SODIPODI_NAMESPACE])),
             'inkscape:groupmode': SVGAttribute('inkscape:groupmode',
                                                anim=False,
                                                types=[],
             'inkscape:groupmode': SVGAttribute('inkscape:groupmode',
                                                anim=False,
                                                types=[],
@@ -33,9 +36,9 @@ class InkscapeDrawing(svgwrite.Drawing):
                                            types=frozenset(['string']),
                                            const=[]),
             'sodipodi:insensitive': SVGAttribute('sodipodi:insensitive',
                                            types=frozenset(['string']),
                                            const=[]),
             'sodipodi:insensitive': SVGAttribute('sodipodi:insensitive',
-                                           anim=False,
-                                           types=frozenset(['string']),
-                                           const=[])
+                                                 anim=False,
+                                                 types=frozenset(['string']),
+                                                 const=[])
         }
 
         self.validator.attributes.update(inkscape_attributes)
         }
 
         self.validator.attributes.update(inkscape_attributes)
@@ -53,8 +56,8 @@ class InkscapeDrawing(svgwrite.Drawing):
         g_attributes.add('sodipodi:insensitive')
         elements['g'].valid_attributes = frozenset(g_attributes)
 
         g_attributes.add('sodipodi:insensitive')
         elements['g'].valid_attributes = frozenset(g_attributes)
 
-        self['xmlns:inkscape'] = 'http://www.inkscape.org/namespaces/inkscape'
-        self['xmlns:sodipodi'] = 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'
+        self['xmlns:inkscape'] = self.INKSCAPE_NAMESPACE
+        self['xmlns:sodipodi'] = self.SODIPODI_NAMESPACE
 
     def layer(self, **kwargs):
         """Create an inkscape layer.
 
     def layer(self, **kwargs):
         """Create an inkscape layer.