Skip to content

Commit

Permalink
fixed names of classes
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo-Omenetti <[email protected]>
  • Loading branch information
Matteo-Omenetti authored and Matteo-Omenetti committed Oct 29, 2024
1 parent 6bd97bd commit 12a8356
Show file tree
Hide file tree
Showing 2 changed files with 373 additions and 40 deletions.
67 changes: 28 additions & 39 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ class PictureMiscData(BaseModel):
content: Dict[str, Any]


class Line(BaseModel):
"""
Represents a line in a line chart.
class ChartLine(BaseModel):
"""Represents a line in a line chart.
Attributes:
label (str): The label for the line.
Expand All @@ -111,9 +110,8 @@ class Line(BaseModel):
values: List[Tuple[float, float]]


class Bar(BaseModel):
"""
Represents a bar in a bar chart.
class ChartBar(BaseModel):
"""Represents a bar in a bar chart.
Attributes:
label (str): The label for the bar.
Expand All @@ -124,9 +122,8 @@ class Bar(BaseModel):
values: float


class StackedBar(BaseModel):
"""
Represents a stacked bar in a stacked bar chart.
class ChartStackedBar(BaseModel):
"""Represents a stacked bar in a stacked bar chart.
Attributes:
label (List[str]): The labels for the stacked bars. Multiple values are stored
Expand All @@ -140,9 +137,8 @@ class StackedBar(BaseModel):
values: List[Tuple[str, int]]


class Slice(BaseModel):
"""
Represents a slice in a pie chart.
class ChartSlice(BaseModel):
"""Represents a slice in a pie chart.
Attributes:
label (str): The label for the slice.
Expand All @@ -153,108 +149,101 @@ class Slice(BaseModel):
value: float


class Point(BaseModel):
"""
Represents a point in a scatter chart.
class ChartPoint(BaseModel):
"""Represents a point in a scatter chart.
Attributes:
value (Tuple[float, float]): A (x, y) coordinate pair representing a point in a
chart.
"""

value: Tuple[float, float]


class PictureChartData(BaseModel):
"""
Base class for picture chart data.
"""Base class for picture chart data.
Attributes:
title (str): The title of the chart.
"""

title: str


class PictureLineChartData(PictureChartData):
"""
Represents data of a line chart.
"""Represents data of a line chart.
Attributes:
kind (Literal["line_chart_data"]): The type of the chart.
x_axis_label (str): The label for the x-axis.
y_axis_label (str): The label for the y-axis.
lines (List[Line]): A list of lines in the chart.
lines (List[ChartLine]): A list of lines in the chart.
"""

kind: Literal["line_chart_data"] = "line_chart_data"
x_axis_label: str
y_axis_label: str
lines: List[Line]
lines: List[ChartLine]


class PictureBarChartData(PictureChartData):
"""
Represents data of a bar chart.
"""Represents data of a bar chart.
Attributes:
kind (Literal["bar_chart_data"]): The type of the chart.
x_axis_label (str): The label for the x-axis.
y_axis_label (str): The label for the y-axis.
bars (List[Bar]): A list of bars in the chart.
bars (List[ChartBar]): A list of bars in the chart.
"""

kind: Literal["bar_chart_data"] = "bar_chart_data"
x_axis_label: str
y_axis_label: str
bars: List[Bar]
bars: List[ChartBar]


class PictureStackedBarChartData(PictureChartData):
"""
Represents data of a stacked bar chart.
"""Represents data of a stacked bar chart.
Attributes:
kind (Literal["stacked_bar_chart_data"]): The type of the chart.
x_axis_label (str): The label for the x-axis.
y_axis_label (str): The label for the y-axis.
stacked_bars (List[StackedBar]): A list of stacked bars in the chart.
stacked_bars (List[ChartStackedBar]): A list of stacked bars in the chart.
"""

kind: Literal["stacked_bar_chart_data"] = "stacked_bar_chart_data"
x_axis_label: str
y_axis_label: str
stacked_bars: List[StackedBar]
stacked_bars: List[ChartStackedBar]


class PicturePieChartData(PictureChartData):
"""
Represents data of a pie chart.
"""Represents data of a pie chart.
Attributes:
kind (Literal["pie_chart_data"]): The type of the chart.
slices (List[Slice]): A list of slices in the pie chart.
slices (List[ChartSlice]): A list of slices in the pie chart.
"""

kind: Literal["pie_chart_data"] = "pie_chart_data"
slices: List[Slice]
slices: List[ChartSlice]


class PictureScatterChartData(PictureChartData):
"""
Represents data of a scatter chart.
"""Represents data of a scatter chart.
Attributes:
kind (Literal["scatter_chart_data"]): The type of the chart.
x_axis_label (str): The label for the x-axis.
y_axis_label (str): The label for the y-axis.
points (List[Point]): A list of points in the scatter chart.
points (List[ChartPoint]): A list of points in the scatter chart.
"""

kind: Literal["scatter_chart_data"] = "scatter_chart_data"
x_axis_label: str
y_axis_label: str
points: List[Point]
points: List[ChartPoint]


PictureDataType = Annotated[
Expand Down
Loading

0 comments on commit 12a8356

Please sign in to comment.