Skip to content

Commit 593f13a

Browse files
authored
Merge pull request #370 from yarikoptic/enh-codespell
Add codespell support (config, workflow to detect/not fix) and make it fix some typos
2 parents 9279d1f + 7d4c337 commit 593f13a

File tree

13 files changed

+58
-18
lines changed

13 files changed

+58
-18
lines changed

.github/workflows/codespell.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Codespell configuration is within pyproject.toml
2+
---
3+
name: Codespell
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
codespell:
16+
name: Check for spelling errors
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Annotate locations with typos
23+
uses: codespell-project/codespell-problem-matcher@v1
24+
- name: Codespell
25+
uses: codespell-project/actions-codespell@v2

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ repos:
1010
hooks:
1111
- id: black
1212
files: ^src/|^tests/
13+
- repo: https://github.com/codespell-project/codespell
14+
# Configuration for codespell is in .pre-commit-config.yaml
15+
rev: v2.4.1
16+
hooks:
17+
- id: codespell
18+
additional_dependencies:
19+
- tomli # for python_version < '3.11'
20+
exclude: ^doc/releases/.*\.rst

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ omit = [
6565

6666
[tool.black]
6767
line-length = 120
68+
69+
[tool.codespell]
70+
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
71+
skip = '.git*,*.pdf,*.svg,data,./doc/releases'
72+
check-hidden = true
73+
# ignore-regex = ''
74+
ignore-words-list = 'compiletime'

resources/generate_cambridgeneurotech_libray.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
The script have been modified by Smauel Garcia ([email protected]):
99
* more pytonic
1010
* improve code readability
11-
* not more channel_device_index the order is the conatct index
11+
* not more channel_device_index the order is the contact index
1212
* simpler function for plotting.
1313
1414
2021-04-02
@@ -72,7 +72,7 @@
7272

7373
def convert_probe_shape(listCoord):
7474
'''
75-
This is to convert reference point probe shape inputed in excel
75+
This is to convert reference point probe shape inputted in excel
7676
as string 'x y x y x y that outline the shape of one shanck
7777
and can be converted to an array to draw the porbe
7878
'''
@@ -95,7 +95,7 @@ def get_contact_order(connector, probe_type):
9595
This will help to re-order the probe contact later on.
9696
"""
9797

98-
# first part of the function to opne the proper connector based on connector name
98+
# first part of the function to open the proper connector based on connector name
9999

100100
# header [0,1] is used to create a mutliindex
101101
df = pd.read_excel(probe_map_file, sheet_name=connector, header=[0,1])
@@ -188,7 +188,7 @@ def generate_CN_multi_shank(probe_info):
188188

189189
def create_CN_figure(probe_name, probe):
190190
"""
191-
Create custum figire for CN with custum colors + logo
191+
Create custom figire for CN with custom colors + logo
192192
"""
193193
fig, ax = plt.subplots()
194194
fig.set_size_inches(18.5, 10.5)

resources/generate_neuropixels_library.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def generate_all_npx():
5151

5252
probe = _make_npx_probe_from_description(pt_metadata, model_name, elec_ids, shank_ids)
5353

54-
# ploting
54+
# plotting
5555
fig, axs = plt.subplots(ncols=2)
5656

5757
ax = axs[0]

src/probeinterface/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def read_csv(file: str | Path):
728728

729729
def write_csv(file, probe):
730730
"""
731-
Write contact postions into a 2 or 3 columns csv file
731+
Write contact positions into a 2 or 3 columns csv file
732732
"""
733733

734734
raise NotImplementedError

src/probeinterface/neuropixels_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _load_np_probe_features():
6767
"NP2020": "2020",
6868
# Ultra
6969
"NP1100": "1100", # Ultra probe - 1 bank
70-
"NP1110": "1110", # Ultra probe - 16 banks no handle beacuse
70+
"NP1110": "1110", # Ultra probe - 16 banks no handle because
7171
"NP1121": "1121", # Ultra probe - beta configuration
7272
# Opto
7373
"NP1300": "1300", # Opto probe
@@ -103,7 +103,7 @@ def get_probe_length(probe_part_number: str) -> int:
103103
Returns
104104
-------
105105
probe_length : int
106-
Lenth of full probe (microns)
106+
Length of full probe (microns)
107107
"""
108108

109109
probe_length = 10_000
@@ -1128,7 +1128,7 @@ def get_saved_channel_indices_from_openephys_settings(
11281128
if len(possible_custom_streams) > 1:
11291129
warnings.warn(
11301130
f"More than one custom parameters associated to {stream_name} "
1131-
f"found. Using fisrt one"
1131+
f"found. Using first one"
11321132
)
11331133
custom_stream = possible_custom_streams[0]
11341134
else:

src/probeinterface/probe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ def add_probe_to_zarr_group(self, group: "zarr.Group") -> None:
11541154
data = probe_arr[field_name]
11551155
group.create_dataset(name=field_name, data=data, dtype=dtype, chunks=False)
11561156

1157-
# Annotations as a group (special attibutes are stored as annotations)
1157+
# Annotations as a group (special attributes are stored as annotations)
11581158
annotations_group = group.create_group("annotations")
11591159
for key, value in self.annotations.items():
11601160
annotations_group.attrs[key] = value

src/probeinterface/probegroup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def set_global_device_channel_indices(self, channels: np.array | list):
226226
f"Wrong channels size {channels.size} for the number of channels {self.get_contact_count()}"
227227
)
228228

229-
# first reset previsous indices
229+
# first reset previous indices
230230
for i, probe in enumerate(self.probes):
231231
n = probe.get_contact_count()
232232
probe.set_device_channel_indices([-1] * n)

src/probeinterface/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def generate_unique_ids(min: int, max: int, n: int, trials: int = 20) -> np.arra
113113
Parameters
114114
----------
115115
min : int
116-
Minimun value permitted for an identifier
116+
Minimum value permitted for an identifier
117117
max : int
118118
Maximum value permitted for an identifier
119119
n : int

0 commit comments

Comments
 (0)