From eb64949186da34332a2a12705d3d376e9d30a2c2 Mon Sep 17 00:00:00 2001 From: Dennis Terhorst Date: Fri, 28 Feb 2025 13:40:06 +0100 Subject: [PATCH 1/2] whitespace changes for black-25 --- .../templates/pynest_api_template.py | 24 +++++++++---------- .../stimulus_params_EI.py | 5 ++-- .../examples/Potjans_2014/stimulus_params.py | 5 ++-- pynest/nest/lib/hl_api_types.py | 12 +++++----- pynest/nest/raster_plot.py | 2 +- .../sli2py_neurons/test_model_node_init.py | 10 ++++---- 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/doc/htmldoc/developer_space/templates/pynest_api_template.py b/doc/htmldoc/developer_space/templates/pynest_api_template.py index 8f41abcd40..e35fb67e05 100644 --- a/doc/htmldoc/developer_space/templates/pynest_api_template.py +++ b/doc/htmldoc/developer_space/templates/pynest_api_template.py @@ -21,18 +21,18 @@ """[[ This template demonstrates how to create a docstring for the PyNEST API. - If you have modified an API, please ensure you update the docstring! - - The format is based on `NumPy style docstring - `_ and uses - reStructuredText markup. Please review the syntax rules if you are - unfamiliar with either reStructuredText or NumPy style docstrings. - - Copy this file and replace the sample text with a description of the API. - The double bracketed sections [[ ]], which provide explanations, should be - completely removed from your final version - Including this entire - docstring! - ]] +If you have modified an API, please ensure you update the docstring! + +The format is based on `NumPy style docstring +`_ and uses +reStructuredText markup. Please review the syntax rules if you are +unfamiliar with either reStructuredText or NumPy style docstrings. + +Copy this file and replace the sample text with a description of the API. +The double bracketed sections [[ ]], which provide explanations, should be +completely removed from your final version - Including this entire +docstring! +]] """ diff --git a/pynest/examples/EI_clustered_network/stimulus_params_EI.py b/pynest/examples/EI_clustered_network/stimulus_params_EI.py index 687d557aa7..f07097c4b5 100644 --- a/pynest/examples/EI_clustered_network/stimulus_params_EI.py +++ b/pynest/examples/EI_clustered_network/stimulus_params_EI.py @@ -19,11 +19,10 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -""" PyNEST EI-clustered network: Stimulus Parameters ------------------------------------------------------ +"""PyNEST EI-clustered network: Stimulus Parameters +------------------------------------------------ A dictionary with parameters for an optinal stimulation of clusters. - """ stim_dict = { diff --git a/pynest/examples/Potjans_2014/stimulus_params.py b/pynest/examples/Potjans_2014/stimulus_params.py index 5a580fdadd..22f22d9f8a 100644 --- a/pynest/examples/Potjans_2014/stimulus_params.py +++ b/pynest/examples/Potjans_2014/stimulus_params.py @@ -19,12 +19,11 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -""" PyNEST Microcircuit: Stimulus Parameters ------------------------------------------------ +"""PyNEST Microcircuit: Stimulus Parameters +---------------------------------------- A dictionary with parameters for an optional external transient stimulation. Thalamic input and DC input can be switched on individually. - """ import numpy as np diff --git a/pynest/nest/lib/hl_api_types.py b/pynest/nest/lib/hl_api_types.py index 16294e142c..a60c61d863 100644 --- a/pynest/nest/lib/hl_api_types.py +++ b/pynest/nest/lib/hl_api_types.py @@ -755,12 +755,12 @@ def format_row_(s, t, sm, w, dly): # 35 is arbitrarily chosen. if len(srcs) >= MAX_SIZE_FULL_PRINT and not self.print_full: - # u'\u22EE ' is the unicode for vertical ellipsis, used when we have many connections - srcs = srcs[:15] + ["\u22EE "] + srcs[-15:] - trgt = trgt[:15] + ["\u22EE "] + trgt[-15:] - wght = wght[:15] + ["\u22EE "] + wght[-15:] - dlay = dlay[:15] + ["\u22EE "] + dlay[-15:] - s_model = s_model[:15] + ["\u22EE "] + s_model[-15:] + # u'\u22ee ' is the unicode for vertical ellipsis, used when we have many connections + srcs = srcs[:15] + ["\u22ee "] + srcs[-15:] + trgt = trgt[:15] + ["\u22ee "] + trgt[-15:] + wght = wght[:15] + ["\u22ee "] + wght[-15:] + dlay = dlay[:15] + ["\u22ee "] + dlay[-15:] + s_model = s_model[:15] + ["\u22ee "] + s_model[-15:] headers = f"{src_h:^{src_len}} {trg_h:^{trg_len}} {sm_h:^{sm_len}} {w_h:^{w_len}} {d_h:^{d_len}}" + "\n" borders = ( diff --git a/pynest/nest/raster_plot.py b/pynest/nest/raster_plot.py index 410125c51f..dba13882ca 100644 --- a/pynest/nest/raster_plot.py +++ b/pynest/nest/raster_plot.py @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -""" Functions for raster plotting.""" +"""Functions for raster plotting.""" import nest import numpy diff --git a/testsuite/pytests/sli2py_neurons/test_model_node_init.py b/testsuite/pytests/sli2py_neurons/test_model_node_init.py index 3179a2b3cf..6f7c1df880 100644 --- a/testsuite/pytests/sli2py_neurons/test_model_node_init.py +++ b/testsuite/pytests/sli2py_neurons/test_model_node_init.py @@ -21,12 +21,12 @@ """ - Makeshift test to see if setting model params and then creating a neuron - and creating a neuron and then setting node params lead to the same - results. +Makeshift test to see if setting model params and then creating a neuron +and creating a neuron and then setting node params lead to the same +results. - Works by connecting device to iaf_psc_alpha, measuring voltage trace over 1s - and comparing traces. +Works by connecting device to iaf_psc_alpha, measuring voltage trace over 1s +and comparing traces. """ import nest From 1f038df545d02fd7a8a028a79494fd804b6c656c Mon Sep 17 00:00:00 2001 From: Dennis Terhorst Date: Fri, 28 Feb 2025 13:44:04 +0100 Subject: [PATCH 2/2] Make multi-line docstrings start on a new line consistently. --- doc/htmldoc/developer_space/templates/pynest_api_template.py | 3 ++- pynest/examples/EI_clustered_network/stimulus_params_EI.py | 3 ++- pynest/examples/Potjans_2014/stimulus_params.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/htmldoc/developer_space/templates/pynest_api_template.py b/doc/htmldoc/developer_space/templates/pynest_api_template.py index e35fb67e05..7b4da5e0bc 100644 --- a/doc/htmldoc/developer_space/templates/pynest_api_template.py +++ b/doc/htmldoc/developer_space/templates/pynest_api_template.py @@ -19,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -"""[[ This template demonstrates how to create a docstring for the PyNEST API. +""" +[[ This template demonstrates how to create a docstring for the PyNEST API. If you have modified an API, please ensure you update the docstring! diff --git a/pynest/examples/EI_clustered_network/stimulus_params_EI.py b/pynest/examples/EI_clustered_network/stimulus_params_EI.py index f07097c4b5..3a5db3e58e 100644 --- a/pynest/examples/EI_clustered_network/stimulus_params_EI.py +++ b/pynest/examples/EI_clustered_network/stimulus_params_EI.py @@ -19,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -"""PyNEST EI-clustered network: Stimulus Parameters +""" +PyNEST EI-clustered network: Stimulus Parameters ------------------------------------------------ A dictionary with parameters for an optinal stimulation of clusters. diff --git a/pynest/examples/Potjans_2014/stimulus_params.py b/pynest/examples/Potjans_2014/stimulus_params.py index 22f22d9f8a..0b38d9c1e1 100644 --- a/pynest/examples/Potjans_2014/stimulus_params.py +++ b/pynest/examples/Potjans_2014/stimulus_params.py @@ -19,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with NEST. If not, see . -"""PyNEST Microcircuit: Stimulus Parameters +""" +PyNEST Microcircuit: Stimulus Parameters ---------------------------------------- A dictionary with parameters for an optional external transient stimulation.