parameters: (self, trans=None)
return_statement: return line
docstring: Apply the transformation "trans" and return an SVG object.
docstring_summary: Apply the transformation "trans" and return an SVG object.
docstring_tokens: Apply the transformation trans and return an SVG object .
function: def SVG(self, trans=None):
          """Apply the transformation "trans" and return an SVG object."""
          if isinstance(trans, basestring):
              trans = totrans(trans)
  
          X1, Y1, X2, Y2 = self.x1, self.y1, self.x2, self.y2
  
          if self.local1:
              X1, Y1 = trans(X1, Y1)
          if self.local2:
              X2, Y2 = trans(X2, Y2)
  
          line = SVG("path", d="M%s %s L%s %s" % (X1, Y1, X2, Y2), **self.attr)
  
          if ((self.arrow_start != False and self.arrow_start is not None) or
              (self.arrow_end != False and self.arrow_end is not None)):
              defs = SVG("defs")
  
              if self.arrow_start != False and self.arrow_start is not None:
                  if isinstance(self.arrow_start, SVG):
                      defs.append(self.arrow_start)
                      line.attr["marker-start"] = "url(#%s)" % self.arrow_start["id"]
                  elif isinstance(self.arrow_start, basestring):
                      defs.append(make_marker(self.arrow_start, "arrow_start"))
                      line.attr["marker-start"] = "url(#%s)" % self.arrow_start
                  else:
                      raise TypeError("arrow_start must be False/None or an id string for the new marker")
  
              if self.arrow_end != False and self.arrow_end is not None:
                  if isinstance(self.arrow_end, SVG):
                      defs.append(self.arrow_end)
                      line.attr["marker-end"] = "url(#%s)" % self.arrow_end["id"]
                  elif isinstance(self.arrow_end, basestring):
                      defs.append(make_marker(self.arrow_end, "arrow_end"))
                      line.attr["marker-end"] = "url(#%s)" % self.arrow_end
                  else:
                      raise TypeError("arrow_end must be False/None or an id string for the new marker")
  
              return SVG("g", defs, line)
  
          return line
function_tokens: def SVG ( self , trans = None ) : if isinstance ( trans , basestring ) : trans = totrans ( trans ) X1 , Y1 , X2 , Y2 = self . x1 , self . y1 , self . x2 , self . y2 if self . local1 : X1 , Y1 = trans ( X1 , Y1 ) if self . local2 : X2 , Y2 = trans ( X2 , Y2 ) line = SVG ( "path" , d = "M%s %s L%s %s" % ( X1 , Y1 , X2 , Y2 ) , * * self . attr ) if ( ( self . arrow_start != False and self . arrow_start is not None ) or ( self . arrow_end != False and self . arrow_end is not None ) ) : defs = SVG ( "defs" ) if self . arrow_start != False and self . arrow_start is not None : if isinstance ( self . arrow_start , SVG ) : defs . append ( self . arrow_start ) line . attr [ "marker-start" ] = "url(#%s)" % self . arrow_start [ "id" ] elif isinstance ( self . arrow_start , basestring ) : defs . append ( make_marker ( self . arrow_start , "arrow_start" ) ) line . attr [ "marker-start" ] = "url(#%s)" % self . arrow_start else : raise TypeError ( "arrow_start must be False/None or an id string for the new marker" ) if self . arrow_end != False and self . arrow_end is not None : if isinstance ( self . arrow_end , SVG ) : defs . append ( self . arrow_end ) line . attr [ "marker-end" ] = "url(#%s)" % self . arrow_end [ "id" ] elif isinstance ( self . arrow_end , basestring ) : defs . append ( make_marker ( self . arrow_end , "arrow_end" ) ) line . attr [ "marker-end" ] = "url(#%s)" % self . arrow_end else : raise TypeError ( "arrow_end must be False/None or an id string for the new marker" ) return SVG ( "g" , defs , line ) return line