Skip to content

Commit 11bdb00

Browse files
hmgaudeckerclaudeMImmesberger
authored
Migrate docstrings from NumPy to Google convention (#1140)
## Summary - Switch `pydocstyle.convention` from `"numpy"` to `"google"` in `pyproject.toml` - Convert docstrings in `src/gettsim/plot/dag/__init__.py` (the only gettsim file with NumPy-style sections) - Policy functions already had summary-only docstrings — no changes needed there Closes #1139 ## Test plan - [x] `pixi run ty` — all checks passed - [x] `pixi run ty-jax` — all checks passed - [x] `prek run --all-files` — all passed - [x] `pixi run -e py314 tests -n 7` — 2471 passed - [x] `grep -rn "^ ----------" src/` — no remaining NumPy-style dashes 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Marvin Immesberger <immesberger@posteo.de>
1 parent 539c421 commit 11bdb00

File tree

4 files changed

+56
-78
lines changed

4 files changed

+56
-78
lines changed

pixi.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ per-file-ignores."src/gettsim/tests_germany/**/*.py" = [
132132
per-file-ignores."src/gettsim/typing.py" = [
133133
"F401", # Imported but unused — re-exports
134134
]
135-
pydocstyle.convention = "numpy"
135+
pydocstyle.convention = "google"
136136

137137
[tool.pyproject-fmt]
138138
column_width = 88

src/gettsim/germany/grundsicherung/im_alter/einkommen.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ def erwerbseinkommen_m(
6868
6969
Legal reference: § 82 SGB XII Abs. 3
7070
71-
Notes
72-
-----
73-
- Freibeträge for income are currently not considered
74-
- Start date is 2011 because of the reference to regelbedarfsstufen,
75-
which was introduced in 2011.
76-
- The cap at 1/2 of Regelbedarf was only introduced in 2006 (which is currently
77-
not implemented): https://www.buzer.de/gesetz/3415/al3764-0.htm
71+
Note:
72+
- Freibeträge for income are currently not considered
73+
- Start date is 2011 because of the reference to regelbedarfsstufen,
74+
which was introduced in 2011.
75+
- The cap at 1/2 of Regelbedarf was only introduced in 2006 (which is currently
76+
not implemented): https://www.buzer.de/gesetz/3415/al3764-0.htm
7877
"""
7978
earnings = (
8079
einnahmen__bruttolohn_m

src/gettsim/plot/dag/__init__.py

Lines changed: 47 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,11 @@ def interface(
6161
) -> go.Figure:
6262
"""Plot the interface DAG.
6363
64-
Parameters
65-
----------
66-
include_fail_and_warn_nodes
67-
Whether to include fail and warn nodes.
68-
show_node_description
69-
Whether to show the node description.
70-
output_path
71-
If provided, the figure is written to the path.
72-
node_colormap
73-
Dictionary mapping namespace tuples to colors.
64+
Args:
65+
include_fail_and_warn_nodes: Whether to include fail and warn nodes.
66+
show_node_description: Whether to show the node description.
67+
output_path: If provided, the figure is written to the path.
68+
node_colormap: Dictionary mapping namespace tuples to colors.
7469
- Tuples can represent any level of the namespace hierarchy (e.g.,
7570
("input_data",) would be the first level,
7671
("input_data", "df_and_mapper") the second level.
@@ -80,14 +75,14 @@ def interface(
8075
match will be used.
8176
- Fallback color is black.
8277
- Use any color from https://plotly.com/python/css-colors/
83-
If None, cycle through colors at the uppermost level of the namespace hierarchy.
84-
kwargs
85-
Additional keyword arguments. Will be passed to
86-
plotly.graph_objects.Figure.layout.
87-
88-
Returns
89-
-------
90-
The figure.
78+
If None, cycle through colors at the uppermost level of the namespace
79+
hierarchy.
80+
kwargs: Additional keyword arguments. Will be passed to
81+
plotly.graph_objects.Figure.layout.
82+
83+
Returns:
84+
The figure.
85+
9186
"""
9287
return ttsim.plot.dag.interface(
9388
include_fail_and_warn_nodes=include_fail_and_warn_nodes,
@@ -125,36 +120,29 @@ def tt(
125120
) -> go.Figure:
126121
"""Plot the TT DAG.
127122
128-
Parameters
129-
----------
130-
primary_nodes
131-
The primary nodes, specified as tree paths (e.g.,
132-
`{("einkommensteuer", "abgeltungssteuer", "betrag_y_sn")}`) or qualified names
133-
(e.g., `{"einkommensteuer__abgeltungssteuer__betrag_y_sn"}`). Primary nodes are
134-
used to determine which other nodes to include in the plot based on the
135-
selection_type. They may be root nodes (for descendants), end nodes (for
136-
ancestors), or middle nodes (for neighbors). If not provided, the entire DAG is
137-
plotted.
138-
selection_type
139-
The type of the DAG to plot. Can be one of:
123+
Args:
124+
primary_nodes: The primary nodes, specified as tree paths (e.g.,
125+
`{("einkommensteuer", "abgeltungssteuer", "betrag_y_sn")}`) or qualified
126+
names (e.g., `{"einkommensteuer__abgeltungssteuer__betrag_y_sn"}`).
127+
Primary nodes are used to determine which other nodes to include in the
128+
plot based on the selection_type. They may be root nodes (for descendants),
129+
end nodes (for ancestors), or middle nodes (for neighbors). If not
130+
provided, the entire DAG is plotted.
131+
selection_type: The type of the DAG to plot. Can be one of:
140132
- "neighbors": Plot the neighbors of the primary nodes.
141133
- "descendants": Plot the descendants of the primary nodes.
142134
- "ancestors": Plot the ancestors of the primary nodes.
143135
- "all_paths": All paths between the primary nodes are displayed (including
144136
any other nodes lying on these paths). You must pass at least two primary
145137
nodes.
146-
If not provided, the entire DAG is plotted.
147-
selection_depth
148-
The depth of the selection. Only used if selection_type is "neighbors",
149-
"descendants", or "ancestors".
150-
include_params
151-
Include params and param functions when plotting the DAG. Default is True.
152-
show_node_description
153-
Show a description of the node when hovering over it.
154-
output_path
155-
If provided, the figure is written to the path.
156-
node_colormap
157-
Dictionary mapping namespace tuples to colors.
138+
If not provided, the entire DAG is plotted.
139+
selection_depth: The depth of the selection. Only used if selection_type is
140+
"neighbors", "descendants", or "ancestors".
141+
include_params: Include params and param functions when plotting the DAG.
142+
Default is True.
143+
show_node_description: Show a description of the node when hovering over it.
144+
output_path: If provided, the figure is written to the path.
145+
node_colormap: Dictionary mapping namespace tuples to colors.
158146
- Tuples can represent any level of the namespace hierarchy (e.g.,
159147
("sozialversicherung",) would be the first level,
160148
("sozialversicherung", "arbeitslosenversicherung") the second level.
@@ -164,32 +152,23 @@ def tt(
164152
match will be used.
165153
- Fallback color is black.
166154
- Use any color from https://plotly.com/python/css-colors/
167-
If None, cycle through colors at the uppermost level of the namespace hierarchy.
168-
policy_date_str
169-
The date for which to plot the DAG.
170-
orig_policy_objects
171-
The orig policy objects.
172-
input_data
173-
The input data.
174-
processed_data
175-
The processed data.
176-
labels
177-
The labels.
178-
policy_environment
179-
The policy environment.
180-
backend
181-
The backend to use when executing main.
182-
include_fail_nodes
183-
Whether to include fail nodes when executing main.
184-
include_warn_nodes
185-
Whether to include warn nodes when executing main.
186-
kwargs
187-
Additional keyword arguments. Will be passed to
188-
plotly.graph_objects.Figure.layout.
189-
190-
Returns
191-
-------
192-
The figure.
155+
If None, cycle through colors at the uppermost level of the namespace
156+
hierarchy.
157+
policy_date_str: The date for which to plot the DAG.
158+
orig_policy_objects: The orig policy objects.
159+
input_data: The input data.
160+
processed_data: The processed data.
161+
labels: The labels.
162+
policy_environment: The policy environment.
163+
backend: The backend to use when executing main.
164+
include_fail_nodes: Whether to include fail nodes when executing main.
165+
include_warn_nodes: Whether to include warn nodes when executing main.
166+
kwargs: Additional keyword arguments. Will be passed to
167+
plotly.graph_objects.Figure.layout.
168+
169+
Returns:
170+
The figure.
171+
193172
"""
194173
return ttsim.plot.dag.tt(
195174
root=germany.ROOT_PATH,

0 commit comments

Comments
 (0)