Skip to content

Commit 4aa6030

Browse files
committed
Codespell
1 parent 628d7c0 commit 4aa6030

7 files changed

Lines changed: 43 additions & 37 deletions

File tree

.github/workflows/lint.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
python -m flake8 --version
3939
python -m flake8 --count --show-source --statistics src/${PACKAGE} tests
4040
41+
- name: Lint (pydocstyle)
42+
run: |
43+
python -m pydocstyle --version
44+
python -m pydocstyle --count src/${PACKAGE}
45+
4146
# - name: Lint (isort)
4247
# run: |
4348
# python -m isort --version
@@ -59,7 +64,7 @@ jobs:
5964
ruff --version
6065
ruff check src/${PACKAGE} tests
6166
62-
- name: Lint (pydocstyle)
67+
- name: Lint (codespell)
6368
run: |
64-
python -m pydocstyle --version
65-
python -m pydocstyle --count src/${PACKAGE}
69+
codespell --version
70+
codespell --count src/${PACKAGE} tests

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ lint:
8484
$(PYTHON) -m black --check src/$(TARGET) tests
8585
# $(PYTHON) -m mypy --check-untyped-defs --ignore-missing-imports src/$(TARGET)
8686
ruff check src/$(TARGET) tests
87-
# codespell
87+
codespell
8888

8989
docs:
9090
mkdir -p docs/_static

docs/examples/write_ndvi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def main(*argv):
8888
with open(argv[2], "wb") as out_stream:
8989
# Loop over all pixel and calculate the NDVI.
9090
#
91-
# @NOTE: looping over data matrices is not the best soluton.
91+
# @NOTE: looping over data matrices is not the best solution.
9292
# It is done here just for demostrative purposes
9393
for j in range(height):
9494
for i in range(width):

docs/gdal_export_example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function:
203203
.. index:: MPH, SPH
204204

205205
The :func:`epr2gdal` function also stores the contents of the *MPH* and the
206-
*SPH* records as GDAL_ dataset matadata in custom domains:
206+
*SPH* records as GDAL_ dataset metadata in custom domains:
207207

208208
.. raw:: latex
209209

docs/reference.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ Product
193193
for example ``flags.LAND OR flags.CLOUD`` or
194194
``NOT flags.WATER AND flags.TURBID_S``
195195
:param xoffset:
196-
across-track co-ordinate in pixel co-ordinates (zero-based)
196+
across-track coordinate in pixel coordinates (zero-based)
197197
of the upper right corner of the source-region
198198
:param yoffset:
199-
along-track co-ordinate in pixel co-ordinates (zero-based)
199+
along-track coordinate in pixel coordinates (zero-based)
200200
of the upper right corner of the source-region
201201
:param raster:
202202
the raster for the bit-mask. The data type of the raster
@@ -994,17 +994,17 @@ Band
994994

995995
The source-region is a defined part of the whole ENVISAT
996996
:class:`Product` image, which shall be read into a :class:`Raster`.
997-
In this routine the co-ordinates are specified, where the
997+
In this routine the coordinates are specified, where the
998998
source-region to be read starts.
999999
The dimension of the region and the sub-sampling are attributes
10001000
of the :class:`Raster` into which the data are read.
10011001

10021002
:param xoffset:
1003-
across-track source co-ordinate in pixel co-ordinates
1003+
across-track source coordinate in pixel coordinates
10041004
(zero-based) of the upper right corner of the source-region.
10051005
Default 0.
10061006
:param yoffset:
1007-
along-track source co-ordinate in pixel co-ordinates
1007+
along-track source coordinate in pixel coordinates
10081008
(zero-based) of the upper right corner of the source-region.
10091009
Default 0.
10101010
:param raster:
@@ -1034,7 +1034,7 @@ Band
10341034

10351035
The source-region is a defined part of the whole ENVISAT
10361036
:class:`Product` image, which shall be read into a :class:`Raster`.
1037-
In this routine the co-ordinates are specified, where the
1037+
In this routine the coordinates are specified, where the
10381038
source-region to be read starts.
10391039
The dimension of the region and the sub-sampling are attributes
10401040
of the :class:`Raster` into which the data are read.
@@ -1048,11 +1048,11 @@ Band
10481048
into the :class:`Raster`, If not provided reads as much as
10491049
possible
10501050
:param xoffset:
1051-
across-track source co-ordinate in pixel co-ordinates
1051+
across-track source coordinate in pixel coordinates
10521052
(zero-based) of the upper right corner of the source-region.
10531053
Default 0.
10541054
:param yoffset:
1055-
along-track source co-ordinate in pixel co-ordinates
1055+
along-track source coordinate in pixel coordinates
10561056
(zero-based) of the upper right corner of the source-region.
10571057
Default 0.
10581058
:param xstep:
@@ -1161,7 +1161,7 @@ Raster
11611161
:param y:
11621162
the (zero-based) Y coordinate of the pixel
11631163
:returns:
1164-
the typed value at the given co-ordinate
1164+
the typed value at the given coordinate
11651165

11661166

11671167
.. method:: get_elem_size()

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ docs = [
7474
"sphinx",
7575
"sphinx_rtd_theme",
7676
"sphinxcontrib-spelling",
77-
"packaginhg",
77+
"packaging",
7878
"ipython",
7979
]
8080
test = ["pytest", "packaging"]
8181
coverage = ["pytest-cov", "coverage[toml]", {include-group = "test"}]
82-
lint = ["flake8", "pydocstyle", "isort", "black", "ruff"]
82+
lint = ["flake8", "pydocstyle", "isort", "black", "ruff", "codespell"]
8383
dev = [
8484
"python-build",
8585
"twine",
@@ -164,10 +164,11 @@ match='(?!(test_|conf)).*\.py'
164164

165165

166166
[tool.codespell]
167-
skip = "*.pdf,*.ipynb,docs/spelling_wordlist.txt"
167+
skip = "*.pdf,*.ipynb,./docs/spelling_wordlist.txt,*.N1,extern"
168168
count = true
169169
quiet-level = 3
170-
# ignore-words-list = "nd"
170+
# ignore-words-list = ""
171+
ignore-words="docs/spelling_wordlist.txt"
171172

172173

173174
# [tool.mypy]

src/epr/epr.pyx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ cdef class _CLib:
295295
msg = <char*>epr_get_last_err_message()
296296
epr_clear_err()
297297
raise ImportError(
298-
f"unable to inizialize EPR API library: "
298+
f"unable to initialize EPR API library: "
299299
f"{_to_str(msg, 'ascii')}"
300300
)
301301

@@ -531,7 +531,7 @@ cdef class Field(EprObject):
531531
offset += info.tot_size
532532

533533
if not found:
534-
raise EPRError("inable to compute field offset")
534+
raise EPRError("unable to compute field offset")
535535
elif absolute:
536536
offset += self._parent._get_offset(absolute)
537537

@@ -688,7 +688,7 @@ cdef class Field(EprObject):
688688
the field
689689
"""
690690
cdef void* buf = NULL
691-
cdef int nd = 1
691+
cdef int ndim = 1
692692
cdef np.npy_intp shape[1]
693693
cdef np.ndarray out
694694
cdef EPR_Time* t = NULL
@@ -759,7 +759,7 @@ cdef class Field(EprObject):
759759
elif etype == e_tid_string:
760760
if shape[0] != 1:
761761
raise ValueError(f"unexpected number of elements: {shape[0]}")
762-
nd = 0
762+
ndim = 0
763763
dtype = np.NPY_STRING
764764
buf = <char*>epr_get_field_elem_as_str(self._ptr)
765765
if buf is NULL:
@@ -771,7 +771,7 @@ cdef class Field(EprObject):
771771
else:
772772
raise ValueError("invalid field type")
773773

774-
out = np.PyArray_SimpleNewFromData(nd, shape, dtype, <void*>buf)
774+
out = np.PyArray_SimpleNewFromData(ndim, shape, dtype, <void*>buf)
775775
# np.PyArray_CLEARFLAG(out, NPY_ARRAY_WRITEABLE) # new in numpy 1.7
776776
# Make the ndarray keep a reference to this object
777777
np.set_array_base(out, self)
@@ -1047,13 +1047,13 @@ cdef class Record(EprObject):
10471047
# elif isinstance(self._parent, Product):
10481048
(<Product>self._parent)._check_write_mode()
10491049

1050-
cdef inline uint _get_offset(self, bint absolure=0):
1050+
cdef inline uint _get_offset(self, bint absolute=0):
10511051
cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
10521052
cdef uint offset = self._index * info.tot_size
10531053

10541054
# assert self._index is not None
10551055

1056-
if absolure:
1056+
if absolute:
10571057
offset += (<Dataset>self._parent)._get_offset()
10581058

10591059
return offset
@@ -1363,7 +1363,7 @@ cdef class Raster(EprObject):
13631363
:param y:
13641364
the (zero-based) Y coordinate of the pixel
13651365
:returns:
1366-
the typed value at the given co-ordinate
1366+
the typed value at the given coordinate
13671367
"""
13681368
if (x < 0 or <uint>x >= self._ptr.raster_width or
13691369
y < 0 or <uint>y >= self._ptr.raster_height):
@@ -1808,15 +1808,15 @@ cdef class Band(EprObject):
18081808
src_width = scene_width
18091809
elif src_width > scene_width:
18101810
raise ValueError(
1811-
f"requeted raster width ({src_width}) is too large for the "
1811+
f"requested raster width ({src_width}) is too large for the "
18121812
f"Band (scene_width={scene_width})"
18131813
)
18141814

18151815
if src_height == 0:
18161816
src_height = scene_height
18171817
elif src_height > scene_height:
18181818
raise ValueError(
1819-
f"requeted raster height ({src_height}) is too large for the "
1819+
f"requested raster height ({src_height}) is too large for the "
18201820
f"Band (scene_height={scene_height})"
18211821
)
18221822

@@ -1852,16 +1852,16 @@ cdef class Band(EprObject):
18521852
18531853
The source-region is a defined part of the whole ENVISAT
18541854
product image, which shall be read into a raster.
1855-
In this routine the co-ordinates are specified, where the
1855+
In this routine the coordinates are specified, where the
18561856
source-region to be read starts.
18571857
The dimension of the region and the sub-sampling are attributes
18581858
of the raster into which the data are read.
18591859
18601860
:param xoffset:
1861-
across-track source co-ordinate in pixel co-ordinates
1861+
across-track source coordinate in pixel coordinates
18621862
(zero-based) of the upper right corner of the source-region
18631863
:param yoffset:
1864-
along-track source co-ordinate in pixel co-ordinates
1864+
along-track source coordinate in pixel coordinates
18651865
(zero-based) of the upper right corner of the source-region
18661866
:param raster:
18671867
:class:`Raster` instance set with appropriate parameters to
@@ -1921,7 +1921,7 @@ cdef class Band(EprObject):
19211921
19221922
The source-region is a defined part of the whole ENVISAT
19231923
product image, which shall be read into a raster.
1924-
In this routine the co-ordinates are specified, where the
1924+
In this routine the coordinates are specified, where the
19251925
source-region to be read starts.
19261926
The dimension of the region and the sub-sampling are attributes
19271927
of the raster into which the data are read.
@@ -1933,10 +1933,10 @@ cdef class Band(EprObject):
19331933
the height (along track dimension) of the source to be read
19341934
into the raster. If not provided reads as much as possible
19351935
:param xoffset:
1936-
across-track source co-ordinate in pixel co-ordinates
1936+
across-track source coordinate in pixel coordinates
19371937
(zero-based) of the upper right corner of the source-region
19381938
:param yoffset:
1939-
along-track source co-ordinate in pixel co-ordinates
1939+
along-track source coordinate in pixel coordinates
19401940
(zero-based) of the upper right corner of the source-region
19411941
:param xstep:
19421942
the sub-sampling step across track of the source when
@@ -2571,10 +2571,10 @@ cdef class Product(EprObject):
25712571
``NOT flags.WATER AND flags.TURBID_S``
25722572
25732573
:param xoffset:
2574-
across-track co-ordinate in pixel co-ordinates (zero-based)
2574+
across-track coordinate in pixel coordinates (zero-based)
25752575
of the upper right corner of the source-region
25762576
:param yoffset:
2577-
along-track co-ordinate in pixel co-ordinates (zero-based)
2577+
along-track coordinate in pixel coordinates (zero-based)
25782578
of the upper right corner of the source-region
25792579
:param raster:
25802580
the raster for the bit-mask. The data type of the raster

0 commit comments

Comments
 (0)