line() — langchain Function Reference
Architecture documentation for the line() function in graph_ascii.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 1dbc3354_2bab_b41d_7aa9_14f4624a2a20["line()"] 76bb01c4_195c_1bd6_3c3d_0ecb71e225e5["AsciiCanvas"] 1dbc3354_2bab_b41d_7aa9_14f4624a2a20 -->|defined in| 76bb01c4_195c_1bd6_3c3d_0ecb71e225e5 89ad4f5d_065c_e8f6_983b_d18b7460b090["draw_ascii()"] 89ad4f5d_065c_e8f6_983b_d18b7460b090 -->|calls| 1dbc3354_2bab_b41d_7aa9_14f4624a2a20 d9684099_24e5_2267_1d5c_54ff6c1d5f0d["point()"] 1dbc3354_2bab_b41d_7aa9_14f4624a2a20 -->|calls| d9684099_24e5_2267_1d5c_54ff6c1d5f0d style 1dbc3354_2bab_b41d_7aa9_14f4624a2a20 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/graph_ascii.py lines 117–147
def line(self, x0: int, y0: int, x1: int, y1: int, char: str) -> None:
"""Create a line on ASCII canvas.
Args:
x0: x coordinate where the line should start.
y0: y coordinate where the line should start.
x1: x coordinate where the line should end.
y1: y coordinate where the line should end.
char: 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):
y = y0 if dx == 0 else y0 + round((x - x0) * dy / float(dx))
self.point(x, y, char)
elif y0 < y1:
for y in range(y0, y1 + 1):
x = x0 if dy == 0 else x0 + round((y - y0) * dx / float(dy))
self.point(x, y, char)
else:
for y in range(y1, y0 + 1):
x = x0 if dy == 0 else x1 + round((y - y1) * dx / float(dy))
self.point(x, y, char)
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does line() do?
line() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/graph_ascii.py.
Where is line() defined?
line() is defined in libs/core/langchain_core/runnables/graph_ascii.py at line 117.
What does line() call?
line() calls 1 function(s): point.
What calls line()?
line() is called by 1 function(s): draw_ascii.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free