Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Workaround to fix code snippets issues on pospell#3346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cacrespo wants to merge1 commit intopython:3.13
base:3.13
Choose a base branch
Loading
fromcacrespo:pospell_code_workaround
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletionscripts/check_spell.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@
import sys
import tempfile

import polib
import pospell


Expand DownExpand Up@@ -44,7 +45,29 @@ def check_spell(po_files=None):
if not po_files:
po_files = Path(".").glob("*/*.po")

detected_errors = pospell.spell_check(po_files, personal_dict=output_filename, language="es_ES")
# Workaround issue #3324 FIXME
# It seems that all code snippets have line breaks '\n'. This causes the
# currently indentation issues.

# Create temporary copies of the original files.
po_files_tmp = []
for po_file in po_files:
with open(tempfile.mktemp(), "w") as temp_file:
# Copy content of the .po file
with open(po_file, "r", encoding="utf-8") as f:
temp_file.write(f.read())
po_files_tmp.append(temp_file.name)

# Don't translate probably code entries
polib_temp_file = polib.pofile(temp_file.name)
for entry in polib_temp_file:
if "\n" in entry.msgid:
entry.msgstr = ""
polib_temp_file.save()

detected_errors = pospell.spell_check(po_files_tmp, personal_dict=output_filename, language="es_ES")
for tmp, orig in zip(po_files_tmp, po_files):
print(tmp, " == ", orig)
return detected_errors


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp