I have a project using dash to commit, but it fails when I try to commit the following part:
@app_dash.callback(
Output("output_data_upload", "figure"),
[Input("radioitems_x_axis", "value"), Input("checklist_y_axis", "value")],
[State("data_store", "data")],
)
def update_figure(
selected_signal_of_x_axis: str, selected_signal_of_y_axis: list, data: list
) -> go.Figure:
"""
Plot the figure based on the selections of users.
:param selected_signal_of_x_axis: a selected signal for x-ordination
:type selected_signal_of_x_axis: str
:param selected_signal_of_y_axis: a/several selected signal(s) for y-ordination
:type selected_signal_of_y_axis: list
:param data: the filtered data of the uploaded documents
:type data: list
:return fig: the figure which is showed on the website based on the selection of users.
:rtype: go.Figure
"""
fig = fig_plotting.data_plot(
selected_signal_of_x_axis, selected_signal_of_y_axis, data
)
return fig
The information of TortoiseGit is like this:
black....................................................................Failed
- hook id: black
- files were modified by this hook
reformatted ReportGeneration\subpages\measurement_chart_plot.py
All done! \u2728 \U0001f370 \u2728
1 file reformatted.
nbstripout...........................................(no files to check)Skipped
isort (python)...........................................................Failed
- hook id: isort
- files were modified by this hook
Fixing C:\Users\OneDrive - User\ReportGeneration\subpages\measurement_chart_plot.py
nbqa-black...........................................(no files to check)Skipped
nbqa-isort...........................................(no files to check)Skipped
nbqa-pylint..........................................(no files to check)Skipped
nbqa-ruff............................................(no files to check)Skipped
ruff.....................................................................Passed
[INFO] Restored changes from C:\Users\.cache\pre-commit\patch17047452450-72632.
Is there anyone who could tell me how to solve this issue? Thanks!
by default
isort's formatting is not compatible withblackwhat's happening is black is formatting it one way and then isort is changing it back
you can configure isort to format it in a black compatible way by setting
profile = blackin its config filealternatively you can use another import sorter which is compatible with black (such as my
reorder-python-imports)disclaimer: I wrote pre-commit