Skip to content

Commit e26f060

Browse files
changes.txt docs/ tests/: widen use of codespell.
tests/test_codespell.py Uses codespell's new `--ignore-multiline-regex` option to ignore any text between `codespell:ignore-begin` and `codespell:ignore-end`. Removed exclusions of all files except for non-text files such as .pdf. changes.txt docs/recipes-text.rst docs/samples/national-capitals.py tests/test_story.py tests/test_textbox.py tests/test_textextract.py Fixed some typos and use new `codespell:ignore-begin...codespell:ignore-end` exclusions for regions that necessarily contains incorrect spellings.
1 parent b67412c commit e26f060

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

changes.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Change Log
99
* Fixed issues:
1010

1111
* **Fixed** `4139 <https://github.com/pymupdf/PyMuPDF/issues/4139>`_: Text color numbers change between 1.24.14 and 1.25.0
12-
* **Fixed** `4141 <https://github.com/pymupdf/PyMuPDF/issues/4141>`_: Some insertion methods fails for pages without a /Resouces object
12+
* **Fixed** `4141 <https://github.com/pymupdf/PyMuPDF/issues/4141>`_: Some insertion methods fails for pages without a /Resources object
1313
* **Fixed** `4180 <https://github.com/pymupdf/PyMuPDF/issues/4180>`_: Search problems
1414
* **Fixed** `4182 <https://github.com/pymupdf/PyMuPDF/issues/4182>`_: Text coordinate extraction error
1515
* **Fixed** `4245 <https://github.com/pymupdf/PyMuPDF/issues/4245>`_: Highlighting issue distorted on recent versions
@@ -20,7 +20,7 @@ Change Log
2020
* In annotations:
2121
* Added support for subtype FreeTextCallout.
2222
* Added support for rich text.
23-
* Added miter_limit arg to insert_text*() to allow supression of spikes caused by long miters.
23+
* Added miter_limit arg to insert_text*() to allow suppression of spikes caused by long miters.
2424
* Add Widget Support to `Document.insert_pdf()`.
2525
* Add `bibi` to span dicts.
2626
* Add `synthetic' to char dict.
@@ -68,6 +68,8 @@ Change Log
6868
* **Fixed** `3751 <https://github.com/pymupdf/PyMuPDF/issues/3751>`_: apply_redactions causes part of the page content to be hidden / transparent
6969

7070

71+
.. codespell:ignore-begin
72+
7173
**Changes in version 1.24.14 (2024-11-19)**
7274

7375
* Use MuPDF-1.24.11.
@@ -2624,3 +2626,5 @@ Changes in version 1.9.1 compared to version 1.8.0 are the following:
26242626
* Incremental saves for changes are possible now using the call pattern *doc.save(doc.name, incremental=True)*.
26252627
* A PDF's metadata can now be deleted, set or changed by document method *set_metadata()*. Supports incremental saves.
26262628
* A PDF's bookmarks (or table of contents) can now be deleted, set or changed with the entries of a list using document method *set_toc(list)*. Supports incremental saves.
2629+
2630+
.. codespell:ignore-end

docs/recipes-text.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ This script uses `Page.get_text("words")` to look for a string, handed in via cl
198198

199199
How to Mark Searched Text
200200
~~~~~~~~~~~~~~~~~~~~~~~~~~
201+
202+
.. codespell:ignore-begin
203+
201204
This script searches for text and marks it::
202205

203206
# -*- coding: utf-8 -*-
@@ -222,6 +225,8 @@ This script searches for text and marks it::
222225
# save to a new PDF
223226
doc.save("a-squiggly.pdf")
224227

228+
.. codespell:ignore-end
229+
225230
The result looks like this:
226231

227232
.. image:: images/img-textmarker.*

docs/samples/national-capitals.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Table data. Used to populate a temporary SQL database, which will be processed by the script.
2121
Its only purpose is to avoid carrying around a separate database file.
2222
"""
23+
# codespell:ignore-begin
2324
table_data = """China;Beijing;21542000;1.5%;2018
2425
Japan;Tokyo;13921000;11.2%;2019
2526
DR Congo;Kinshasa;12691000;13.2%;2017
@@ -260,6 +261,7 @@
260261
Cocos (Keeling) Islands (Australia);West Island;134;24.6%;2011
261262
Pitcairn Islands (UK);Adamstown;40;100.0%;2021
262263
South Georgia and the South Sandwich Islands (UK);King Edward Point;22;73.3%;2018"""
264+
# codespell:ignore-end
263265

264266
# -------------------------------------------------------------------
265267
# HTML template for the report. We define no table header <th> items

tests/test_codespell.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,21 @@ def test_codespell():
2727
# is difficult to exclude some text sections.
2828
skips = textwrap.dedent('''
2929
*.pdf
30-
changes.txt
3130
docs/_static/prism/prism.js
3231
docs/_static/prism/prism.js
3332
docs/locales/ja/LC_MESSAGES/changes.po
3433
docs/locales/ja/LC_MESSAGES/recipes-common-issues-and-their-solutions.po
35-
docs/recipes-common-issues-and-their-solutions.rst
36-
docs/recipes-text.rst
37-
docs/samples/national-capitals.py
38-
locales
34+
docs/locales/
3935
src_classic/*
40-
tests
41-
tests/test_story.py
42-
tests/test_textbox.py
43-
tests/test_textextract.py
4436
''')
4537
skips = skips.strip().replace('\n', ',')
4638

4739
command = textwrap.dedent(f'''
4840
cd {root} && codespell
4941
--skip {shlex.quote(skips)}
5042
--ignore-words-list re-use,flate,thirdparty,re-using
43+
--ignore-regex 'https?://[a-z0-9/_.]+'
44+
--ignore-multiline-regex 'codespell:ignore-begin.*codespell:ignore-end'
5145
''')
5246

5347
sys.path.append(root)

tests/test_story.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def make_pdf(html, path_out):
6868
assert len(doc_before) == 2
6969
assert len(doc_after) == 2
7070

71-
71+
# codespell:ignore-begin
7272
springer_html = '''
7373
<article>
7474
<aside>
@@ -98,6 +98,8 @@ def make_pdf(html, path_out):
9898
<p>Vermutlich ist eine derart mit sich selbst be&#173;schäf&#173;tigte Sig&#173;nal&#173;ver&#173;ar&#173;beitung die Vor&#173;be&#173;ding&#173;ung für ge&#173;stei&#173;gerte Hirn&#173;leis&#173;tungen. Um einen Ver&#173;gleich mit verhältnismäßig pri&#173;mi&#173;ti&#173;ver Tech&#173;nik zu wagen: Bei küns&#173;tli&#173;chen neu&#173;ro&#173;na&#173;len Netzen – Algorithmen nach dem Vor&#173;bild verknüpfter Nervenzellen – ge&#173;nü&#173;gen schon ein, zwei so genannte ver&#173;bor&#173;ge&#173;ne Schich&#173;ten von selbst&#173;be&#173;züg&#173;li&#173;chen Schaltstellen zwischen Input und Output-Ebene, um die ver&#173;blüf&#173;fen&#173;den Erfolge der künstlichen Intel&#173;ligenz her&#173;vor&#173;zu&#173;bringen.</p>
9999
</article>
100100
'''
101+
#codespell:ignore-end
102+
101103
def test_fit_springer():
102104

103105
if not hasattr(pymupdf, 'mupdf'):

tests/test_textbox.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
"""
88
import pymupdf
99

10+
# codespell:ignore-begin
1011
text = """Der Kleine Schwertwal (Pseudorca crassidens), auch bekannt als Unechter oder Schwarzer Schwertwal, ist eine Art der Delfine (Delphinidae) und der einzige rezente Vertreter der Gattung Pseudorca.
1112
1213
Er ähnelt dem Orca in Form und Proportionen, ist aber einfarbig schwarz und mit einer Maximallänge von etwa sechs Metern deutlich kleiner.
1314
1415
Kleine Schwertwale bilden Schulen von durchschnittlich zehn bis fünfzig Tieren, wobei sie sich auch mit anderen Delfinen vergesellschaften und sich meistens abseits der Küsten aufhalten.
1516
1617
Sie sind in allen Ozeanen gemäßigter, subtropischer und tropischer Breiten beheimatet, sind jedoch vor allem in wärmeren Jahreszeiten auch bis in die gemäßigte bis subpolare Zone südlich der Südspitze Südamerikas, vor Nordeuropa und bis vor Kanada anzutreffen."""
17-
18+
# codespell:ignore-end
1819

1920
def test_textbox1():
2021
"""Use TextWriter for text insertion."""

0 commit comments

Comments
 (0)