class_docstr: Class for drawing in ASCII.
  
  Args:
      cols (int): number of columns in the canvas. Should be > 1.
      lines (int): number of lines in the canvas. Should be > 1.
class_docstr_tok: ["Class","for","drawing","in","ASCII",".","Args",":","cols","(","int",")",":","number","of","columns","in","the","canvas",".","Should","be",">","1.","lines","(","int",")",":","number","of","lines","in","the","canvas",".","Should","be",">","1","."]
docstr: Create a line on ASCII canvas.
  
  Args:
      x0 (int): x coordinate where the line should start.
      y0 (int): y coordinate where the line should start.
      x1 (int): x coordinate where the line should end.
      y1 (int): y coordinate where the line should end.
      char (str): character to draw the line with.
docstr_tok: ["Create","a","line","on","ASCII","canvas",".","Args",":","x0","(","int",")",":","x","coordinate","where","the","line","should","start",".","y0","(","int",")",":","y","coordinate","where","the","line","should","start",".","x1","(","int",")",":","x","coordinate","where","the","line","should","end",".","y1","(","int",")",":","y","coordinate","where","the","line","should","end",".","char","(","str",")",":","character","to","draw","the","line","with","."]
code: def line(self, x0, y0, x1, y1, char):  # noqa: C901, PLR0912
      """Create a line on ASCII canvas.
  
      Args:
          x0 (int): x coordinate where the line should start.
          y0 (int): y coordinate where the line should start.
          x1 (int): x coordinate where the line should end.
          y1 (int): y coordinate where the line should end.
          char (str): character to draw the line with.
      """
      if x0 > x1:
          x1, x0 = x0, x1
          y1, y0 = y0, y1
  
      dx = x1 - x0
      dy = y1 - y0
  
      if dx == 0 and dy == 0:
          self.point(x0, y0, char)
      elif abs(dx) >= abs(dy):
          for x in range(x0, x1 + 1):
              if dx == 0:
                  y = y0
              else:
                  y = y0 + int(round((x - x0) * dy / float(dx)))
              self.point(x, y, char)
      elif y0 < y1:
          for y in range(y0, y1 + 1):
              if dy == 0:
                  x = x0
              else:
                  x = x0 + int(round((y - y0) * dx / float(dy)))
              self.point(x, y, char)
      else:
          for y in range(y1, y0 + 1):
              if dy == 0:
                  x = x0
              else:
                  x = x1 + int(round((y - y1) * dx / float(dy)))
              self.point(x, y, char)
  
file_path: dvc/dvc/dagascii.py
imports: import math
  import os
  from grandalf.graphs import Edge, Graph, Vertex
  from grandalf.layouts import SugiyamaLayout
  from grandalf.routing import EdgeViewer, route_with_lines
  from dvc.log import logger
label_desc: Use image node_id 4 for calling the AsciiCanvas obj's underlying member method code with example usage: obj.line(x0, y0, x1, y1, char) without return types