Skip to content

Commit d9cfcdd

Browse files
committed
FIX 3 sphinx warnings (#335)
Reviewed-on: https://git.afpy.org/AFPy/python-docs-fr/pulls/335
1 parent 027659c commit d9cfcdd

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

.scripts/line-length.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,34 @@
99
It returns 0 on success, 1 on failure.
1010
"""
1111

12-
from unicodedata import category
1312
import fileinput
1413
import sys
14+
from unicodedata import category
1515

16-
SOFT_LIMIT = 80 # used for splitables lines (with spaces in them)
17-
HARD_LIMIT = 88 # used for non-splitables lines (without spaces in them)
18-
16+
MAX_LINE_LENGTH = 80
1917

2018
def clean(line):
21-
return "".join(char for char in line if category(char) != "Mn").rstrip("\n")
19+
"""Prepare the line to be measured.
20+
21+
See https://lists.gnu.org/archive/html/bug-gettext/2025-10/msg00010.html
22+
about hiding spaces before colon.
23+
"""
24+
line = "".join(char for char in line if category(char) != "Mn").rstrip("\n")
25+
line = line.replace(" :", " :") # It's not allowed to split a line before `:`
26+
return line
2227

2328

2429
return_code = 0
2530

2631
for line in fileinput.input(encoding="utf-8"):
2732
line = clean(line)
28-
limit = SOFT_LIMIT if line.count(" ") > 1 else HARD_LIMIT
29-
if len(set(line)) <= 6:
30-
continue # msgcat does not wraps the long line of dots in howto/perf_profiling.rst
31-
if len(line) > limit:
33+
34+
if line.count(" ") <= 2:
35+
continue # Could be hard to break.
36+
if len(line) > MAX_LINE_LENGTH:
3237
print(
3338
f"{fileinput.filename()}:{fileinput.filelineno()} line too long "
34-
f"({len(line)} > {limit} characters)",
39+
f"({len(line)} > {MAX_LINE_LENGTH} characters)",
3540
file=sys.stderr,
3641
)
3742
return_code = 1

library/stdtypes.po

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ msgstr ""
66
"Project-Id-Version: Python 3\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2025-10-17 09:58+0200\n"
9-
"PO-Revision-Date: 2024-11-02 17:10+0100\n"
10-
"Last-Translator: Loc Cosnier <loc.cosnier@pm.me>\n"
9+
"PO-Revision-Date: 2025-10-17 11:48+0200\n"
10+
"Last-Translator: Julien Palard <julien@palard.fr>\n"
1111
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
1212
"Language: fr\n"
1313
"MIME-Version: 1.0\n"
1414
"Content-Type: text/plain; charset=UTF-8\n"
1515
"Content-Transfer-Encoding: 8bit\n"
1616
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
17-
"X-Generator: Poedit 3.4.2\n"
17+
"X-Generator: Poedit 3.6\n"
1818

1919
#: library/stdtypes.rst:8
2020
msgid "Built-in Types"
@@ -656,9 +656,9 @@ msgstr ""
656656
"la valeur résultante est de type :class:`int`. Pour les opérandes de "
657657
"type :class:`float`,la valeur résultante est de type :class:`float`. En "
658658
"général, la valeur résultante est strictement entière, bien que le type du "
659-
"résultat ne soit pas nécessairement *int*. Le résultat est toujours arrondi "
660-
"vers moins l'infini : ``1//2`` vaut ``0``, ``(-1)//2`` vaut ``-1``, ``1//"
661-
"(-2)`` vaut ``-1``, et ``(-1)//(-2)`` vaut ``0``."
659+
"résultat ne soit pas nécessairement :class:`int`. Le résultat est toujours "
660+
"arrondi vers moins l'infini : ``1//2`` vaut ``0``, ``(-1)//2`` vaut ``-1``, "
661+
"``1//(-2)`` vaut ``-1``, et ``(-1)//(-2)`` vaut ``0``."
662662

663663
#: library/stdtypes.rst:337
664664
msgid ""

reference/import.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ msgstr ""
66
"Project-Id-Version: Python 3\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2025-10-17 09:58+0200\n"
9-
"PO-Revision-Date: 2023-07-08 11:34+0200\n"
10-
"Last-Translator: Christophe Nanteuil <christophe.nanteuil@gmail.com>\n"
9+
"PO-Revision-Date: 2025-10-17 11:44+0200\n"
10+
"Last-Translator: Julien Palard <julien@palard.fr>\n"
1111
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
1212
"Language: fr\n"
1313
"MIME-Version: 1.0\n"
1414
"Content-Type: text/plain; charset=UTF-8\n"
1515
"Content-Transfer-Encoding: 8bit\n"
16-
"X-Generator: Poedit 3.2.2\n"
16+
"X-Generator: Poedit 3.6\n"
1717

1818
#: reference/import.rst:6
1919
msgid "The import system"
@@ -547,7 +547,7 @@ msgstr ""
547547
"chercheurs dans des méta-chemins. Ces chercheurs sont interrogés dans "
548548
"l'ordre pour voir s'ils savent prendre en charge le module passé en "
549549
"paramètre. Les chercheurs dans les méta-chemins implémentent une "
550-
"méthode :meth:`~importlib.abc.MetaPathFinder.find_spec()` qui prend trois "
550+
"méthode :meth:`~importlib.abc.MetaPathFinder.find_spec` qui prend trois "
551551
"arguments : un nom, un chemin d'importation et (optionnellement) un module "
552552
"cible. Un chercheur dans les méta-chemins peut utiliser n'importe quelle "
553553
"stratégie pour déterminer s'il est apte à prendre en charge le module."
@@ -580,7 +580,7 @@ msgid ""
580580
"existing module object that will be the target of loading later. The import "
581581
"system passes in a target module only during reload."
582582
msgstr ""
583-
"La méthode :meth:`~importlib.abc.MetaPathFinder.find_spec()` des chercheurs "
583+
"La méthode :meth:`~importlib.abc.MetaPathFinder.find_spec` des chercheurs "
584584
"dans les méta-chemins est appelée avec deux ou trois arguments. Le premier "
585585
"est le nom complètement qualifié du module à importer, par exemple "
586586
"``truc.machin.bidule``. Le deuxième argument est l'ensemble des chemins dans "
@@ -1168,8 +1168,8 @@ msgid ""
11681168
"module's repr."
11691169
msgstr ""
11701170
"La méthode :meth:`!module_repr` est obsolète depuis Python 3.4, et a été "
1171-
"supprimée en Python 3.12 et n'est donc plus appelée lors de la résolution "
1172-
"du :meth:`__repr__` d'un module."
1171+
"supprimée en Python 3.12 et n'est donc plus appelée lors de la résolution du "
1172+
"``__repr__`` d'un module."
11731173

11741174
#: reference/import.rst:610
11751175
msgid "Cached bytecode invalidation"

tutorial/classes.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ msgstr ""
66
"Project-Id-Version: Python 3\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2025-10-17 09:58+0200\n"
9-
"PO-Revision-Date: 2024-10-01 17:00+0200\n"
10-
"Last-Translator: Jules Lasne <jules.lasne@gmail.com>\n"
9+
"PO-Revision-Date: 2025-10-17 11:37+0200\n"
10+
"Last-Translator: Julien Palard <julien@palard.fr>\n"
1111
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
1212
"Language: fr\n"
1313
"MIME-Version: 1.0\n"
1414
"Content-Type: text/plain; charset=UTF-8\n"
1515
"Content-Transfer-Encoding: 8bit\n"
16-
"X-Generator: Poedit 3.2.1\n"
16+
"X-Generator: Poedit 3.6\n"
1717

1818
#: tutorial/classes.rst:5
1919
msgid "Classes"
@@ -1244,10 +1244,10 @@ msgid ""
12441244
"method :meth:`!m`, and :attr:`m.__func__ <method.__func__>` is "
12451245
"the :ref:`function object <user-defined-funcs>` corresponding to the method."
12461246
msgstr ""
1247-
"Les objets méthodes d'instances ont aussi des attributs : :attr:`m.__self__ "
1248-
"<method.__self__>` est l'instance d'objet avec la méthode :meth:`!m` "
1249-
"et :attr:`m.__func__ <method.__func__>` est l':ref:`objet fonction <user-"
1250-
"defined-funcs>` correspondant à la méthode."
1247+
"Les :ref:`objets méthode d'instance <instance-methods>` ont aussi des "
1248+
"attributs : :attr:`m.__self__ <method.__self__>` est l'instance de l’objet "
1249+
"ayant la méthode :meth:`!m` et :attr:`m.__func__ <method.__func__>` est "
1250+
"l':ref:`objet fonction <user-defined-funcs>` correspondant à la méthode."
12511251

12521252
#: tutorial/classes.rst:782
12531253
msgid "Iterators"

0 commit comments

Comments
 (0)