Skip to content

Commit 8ba5fb3

Browse files
authored
adjusted report related docstrings and added report init (#1159)
* adjusted report related docstrings and added report init * lint fixes * moved field descriptions from docstrings to pydantic Fields * black
1 parent 446f19b commit 8ba5fb3

File tree

6 files changed

+429
-394
lines changed

6 files changed

+429
-394
lines changed

flow360/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
from flow360.component.surface_mesh_v2 import SurfaceMeshV2 as SurfaceMesh
152152
from flow360.component.volume_mesh import VolumeMeshV2 as VolumeMesh
153153
from flow360.environment import Env
154+
from flow360.plugins import report
154155
from flow360.version import __solver_version__, __version__
155156

156157
__all__ = [
@@ -273,4 +274,5 @@
273274
"StreamlineOutput",
274275
"Transformation",
275276
"WallRotation",
277+
"report",
276278
]

flow360/plugins/report/__init__.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""Utilities for creating reports"""
2+
3+
from flow360.plugins.report.report import ReportTemplate
4+
from flow360.plugins.report.report_items import (
5+
Chart2D,
6+
Chart3D,
7+
FixedRangeLimit,
8+
ManualLimit,
9+
NonlinearResiduals,
10+
PatternCaption,
11+
Settings,
12+
SubsetLimit,
13+
Summary,
14+
Table,
15+
)
16+
from flow360.plugins.report.utils import (
17+
Average,
18+
DataItem,
19+
Delta,
20+
Expression,
21+
GetAttribute,
22+
Grouper,
23+
Variable,
24+
)
25+
from flow360.plugins.report.uvf_shutter import (
26+
BottomCamera,
27+
Camera,
28+
FrontCamera,
29+
FrontLeftBottomCamera,
30+
FrontLeftTopCamera,
31+
LeftCamera,
32+
RearCamera,
33+
RearLeftTopCamera,
34+
RearRightBottomCamera,
35+
TopCamera,
36+
)
37+
38+
__all__ = [
39+
"Average",
40+
"BottomCamera",
41+
"Camera",
42+
"Chart2D",
43+
"Chart3D",
44+
"DataItem",
45+
"Delta",
46+
"Expression",
47+
"FixedRangeLimit",
48+
"FrontCamera",
49+
"FrontLeftBottomCamera",
50+
"FrontLeftTopCamera",
51+
"GetAttribute",
52+
"Grouper",
53+
"LeftCamera",
54+
"ManualLimit",
55+
"NonlinearResiduals",
56+
"PatternCaption",
57+
"RearCamera",
58+
"RearLeftTopCamera",
59+
"RearRightBottomCamera",
60+
"ReportTemplate",
61+
"Settings",
62+
"SubsetLimit",
63+
"Summary",
64+
"Table",
65+
"TopCamera",
66+
"Variable",
67+
]

flow360/plugins/report/report.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,16 @@ class ReportTemplate(Flow360BaseModel):
144144
"""
145145
A model representing a report containing various components such as summaries, inputs, tables,
146146
and charts in both 2D and 3D.
147-
148-
Parameters
149-
----------
150-
title: str, optional
151-
Title of report, shown on the first page
152-
items : List[Union[Summary, Inputs, Table, Chart2D, Chart3D]]
153-
A list of report items, each of which can be a summary, input data, table, 2D chart, or 3D chart.
154-
The `type` field acts as a discriminator for differentiating item types.
155-
include_case_by_case : bool, default=True
156-
Flag indicating whether to include a case-by-case analysis in the report.
157147
"""
158148

159-
title: Optional[str] = None
160-
items: List[ReportItemTypes] = pd.Field()
161-
include_case_by_case: bool = False
149+
title: Optional[str] = pd.Field(None, description="Title of report, shown on the first page.")
150+
items: List[ReportItemTypes] = pd.Field(
151+
description="A list of report items, each of which can be a summary, input data, table, 2D chart, or 3D chart."
152+
)
153+
include_case_by_case: bool = pd.Field(
154+
False,
155+
description="Flag indicating whether to include a case-by-case analysis in the report.",
156+
)
162157
settings: Optional[Settings] = Settings()
163158

164159
@pd.model_validator(mode="after")

0 commit comments

Comments
 (0)