Few tests, tox, and travis. (#36)

Few tests, tox, and travis.

Co-authored-by: Jules Lasne (jlasne) <jules.lasne@gmail.com>
This commit is contained in:
Jules Lasne (jlasne) 2019-12-13 14:46:29 +01:00 committed by GitHub
commit 69d57b05d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 3486 additions and 42 deletions

18
.travis.yml Normal file
View File

@ -0,0 +1,18 @@
language: python
cache:
directories:
- .tox/
- $HOME/.cache/pip
matrix:
include:
- python: "3.6"
env: TOX_ENV=py36
- python: "3.7"
env: TOX_ENV=py37
- python: "3.8"
env: TOX_ENV=py38,black,flake8,mypy
install:
- pip uninstall -y virtualenv
- pip install tox
script:
- tox -e $TOX_ENV

View File

@ -26,3 +26,20 @@ optional arguments:
-b BELOW, --below BELOW
Will list all TODOs BELOW given INT% completion
```
## Contributing
You can run the tests using `tox` locally like:
tox -p auto
before commiting.
A pre-commit hook like:
```sh
cat <<EOF > .git/hooks/pre-commit
#!/bin/sh
exec tox -s -p all
EOF
```
may help.

View File

@ -1,31 +1,38 @@
import re
import requests
import subprocess
from typing import Mapping
import requests
def get_repo_url(repo_path: str) -> str:
"""Tries to get the repository url from git commands
"""
try:
url = subprocess.check_output("git remote get-url --all upstream".split(),
universal_newlines=True, cwd=repo_path,
stderr=subprocess.STDOUT)
url = subprocess.check_output(
"git remote get-url --all upstream".split(),
universal_newlines=True,
cwd=repo_path,
stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError:
try:
url = subprocess.check_output("git remote get-url --all origin".split(),
universal_newlines=True, cwd=repo_path,
stderr=subprocess.STDOUT)
url = subprocess.check_output(
"git remote get-url --all origin".split(),
universal_newlines=True,
cwd=repo_path,
stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError as e:
raise RuntimeError(
f"Unknown error. `git get-url --all upstream|origin` returned \"{e.output.rstrip()}\"."
f'Unknown error. `{" ".join(e.cmd)}` returned "{e.output.rstrip()}".'
)
return url
def get_repo_name(repo_path: str) -> str:
"""Will get the repository url from git commands then remove useless stuff to get ORG/NAME
"""Will get the repository url from git commands then remove useless
stuff to get ORG/NAME.
"""
repo_url = get_repo_url(repo_path)
# Removes useless stuff. If it isn't there then nothing happens
@ -33,7 +40,7 @@ def get_repo_name(repo_path: str) -> str:
repo_name = repo_url.replace("https://github.com/", "")
repo_name = repo_name.replace("git@github.com:", "")
repo_name = repo_name.replace(".git", "")
repo_name = repo_name.strip('\n')
repo_name = repo_name.strip("\n")
return repo_name
@ -43,7 +50,11 @@ def get_reservation_list(repo_path: str) -> Mapping[str, str]:
"""
issues: list = []
next_url = "https://api.github.com/repos/" + get_repo_name(repo_path) + "/issues?state=open"
next_url = (
"https://api.github.com/repos/"
+ get_repo_name(repo_path)
+ "/issues?state=open"
)
while next_url:
resp = requests.get(next_url)
issues.extend(resp.json())
@ -53,8 +64,8 @@ def get_reservation_list(repo_path: str) -> Mapping[str, str]:
for issue in issues:
# Maybe find a better way for not using python 3.8 ?
yes = re.search(r'\w*/\w*\.po', issue['title'])
yes = re.search(r"\w*/\w*\.po", issue["title"])
if yes:
reservations[yes.group()] = issue['user']['login']
reservations[yes.group()] = issue["user"]["login"]
return reservations

View File

@ -1,8 +1,8 @@
import polib
from typing import Mapping, Sequence
from pathlib import Path
import polib
class PoFileStats:
"""Class for each `.po` file containing all the necessary information about its progress
@ -50,8 +50,9 @@ class PoFileStats:
def get_po_files_from_repo(repo_path: str) -> Mapping[str, Sequence[PoFileStats]]:
"""Gets all the po files from a given repository.
Will return a list with all directories and PoFile instances of `.po` files in those directories
"""Gets all the po files from a given repository. Will return a list
with all directories and PoFile instances of `.po` files in those
directories.
"""
# Get all the files matching `**/*.po` and not being `.git/` in the given path

View File

@ -1,20 +1,12 @@
#!/usr/bin/env python3
import os
import sys
import argparse
import statistics
from typing import Tuple, Mapping
from pathlib import Path
try:
import polib
import requests
except ImportError:
print("You need to install polib and requests to be able to run potodo.")
sys.exit(1)
from potodo import __version__
from potodo._github import get_reservation_list
from potodo._po_file import PoFileStats, get_po_files_from_repo
@ -36,7 +28,8 @@ def initialize_arguments(
if above and below:
if below < above:
# If above and below are specified and that below is superior to above, raise an error
# If above and below are specified and that below is superior to above,
# raise an error
raise ValueError("Below must be inferior to above")
if not offline and not hide_reserved:
@ -54,9 +47,10 @@ def print_dir_stats(
"""This function prints the directory name, its stats and the buffer
"""
if True in printed_list:
# If at least one of the files isn't done then print the folder stats and file(s)
# Each time a file is went over True or False is placed in the printed_list list.
# If False is placed it means it doesnt need to be printed
# If at least one of the files isn't done then print the
# folder stats and file(s) Each time a file is went over True
# or False is placed in the printed_list list. If False is
# placed it means it doesnt need to be printed
print(f"\n\n# {directory_name} ({statistics.mean(folder_stats):.2f}% done)\n")
print("\n".join(buffer))
@ -71,8 +65,9 @@ def buffer_add(
below: int,
counts: bool,
) -> None:
"""Will add to the buffer the information to print about the file is the file isn't translated
entirely or above or below requested values
"""Will add to the buffer the information to print about the file is
the file isn't translated entirely or above or below requested
values.
"""
if po_file_stats.percent_translated == 100:
# If the file is completely translated
@ -118,9 +113,11 @@ def buffer_add(
if po_file_stats.fuzzy_entries
else ""
)
# The `reserved by` if the file is reserved unless the offline/hide_reservation are enabled
# The `reserved by` if the file is reserved unless the
# offline/hide_reservation are enabled
+ (
f", réservé par {issue_reservations[po_file_stats.filename_dir.lower()]}"
f", réservé par "
f"{issue_reservations[po_file_stats.filename_dir.lower()]}"
if po_file_stats.filename_dir.lower() in issue_reservations
else ""
)
@ -139,9 +136,11 @@ def buffer_add(
if po_file_stats.fuzzy_entries
else ""
)
# The `reserved by` if the file is reserved unless the offline/hide_reservation are enabled
# The `reserved by` if the file is reserved unless the
# offline/hide_reservation are enabled
+ (
f", réservé par {issue_reservations[po_file_stats.filename_dir.lower()]}"
f", réservé par "
f"{issue_reservations[po_file_stats.filename_dir.lower()]}"
if po_file_stats.filename_dir.lower() in issue_reservations
else ""
)
@ -226,10 +225,7 @@ def main():
)
parser.add_argument(
"-p",
"--path",
type=Path,
help="Execute Potodo in the given path"
"-p", "--path", type=Path, help="Execute Potodo in the given path"
)
parser.add_argument(
@ -271,10 +267,13 @@ def main():
"-c",
"--counts",
action="store_true",
help="Render list with the count of remaining entries (translate or review) rather than percentage done",
help="Render list with the count of remaining entries "
"(translate or review) rather than percentage done",
)
parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
parser.add_argument(
"--version", action="version", version="%(prog)s " + __version__
)
args = parser.parse_args()
# If no path is specified, then use the current path

248
tests/fixtures/python-docs-fr/bugs.po vendored Normal file
View File

@ -0,0 +1,248 @@
# Copyright (C) 2001-2018, Python Software Foundation
# For licence information, see README file.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-04 11:33+0200\n"
"PO-Revision-Date: 2019-12-12 00:24+0100\n"
"Last-Translator: Antoine Wecxsteen\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.3\n"
#: ../Doc/bugs.rst:5
msgid "Dealing with Bugs"
msgstr "S'attaquer aux bogues"
#: ../Doc/bugs.rst:7
msgid ""
"Python is a mature programming language which has established a reputation "
"for stability. In order to maintain this reputation, the developers would "
"like to know of any deficiencies you find in Python."
msgstr ""
"Python est un langage de programmation robuste réputé pour sa stabilité. "
"Afin de maintenir cette réputation, les développeurs souhaitent connaître "
"tout problème que vous pourriez rencontrer dans Python."
#: ../Doc/bugs.rst:11
msgid ""
"It can be sometimes faster to fix bugs yourself and contribute patches to "
"Python as it streamlines the process and involves less people. Learn how to :"
"ref:`contribute <contributing-to-python>`."
msgstr ""
"Il est parfois plus rapide de réparer les bogues soi-même et d'en proposer "
"les correctifs, ça simplifie le processus et implique moins de monde. "
"Apprenez à :ref:`contribuer <contributing-to-python>`."
#: ../Doc/bugs.rst:16
msgid "Documentation bugs"
msgstr "Bogues de documentation"
#: ../Doc/bugs.rst:18
msgid ""
"If you find a bug in this documentation or would like to propose an "
"improvement, please submit a bug report on the :ref:`tracker <using-the-"
"tracker>`. If you have a suggestion on how to fix it, include that as well."
msgstr ""
"Si vous trouvez un bogue dans cette documentation ou si vous désirez "
"proposer une amélioration, si cela concerne aussi la documentation en "
"anglais, ouvrez un rapport sur le :ref:`tracker <using-the-tracker>` "
"décrivant en anglais le bogue et où vous l'avez trouvé. Si le problème ne "
"touche que la traduction en français, ouvrez un ticket sur https://github."
"com/python/python-docs-fr/issues, ou venez nous en toucher un mot sur le "
"canal #python-fr sur *freenode* (https://webchat.freenode.net/). Si vous "
"avez une suggestion de correction, merci de l'inclure également."
#: ../Doc/bugs.rst:22
msgid ""
"If you're short on time, you can also email documentation bug reports to "
"docs@python.org (behavioral bugs can be sent to python-list@python.org). "
"'docs@' is a mailing list run by volunteers; your request will be noticed, "
"though it may take a while to be processed."
msgstr ""
"Si vous êtes limité par le temps, vous pouvez aussi envoyer un courriel à "
"docs@python.org (les bogues de comportement peuvent être envoyés à python-"
"list@python.org). 'docs@' est une liste de diffusion gérée par des "
"volontaires, votre requête sera vue, mais elle peut prendre un moment pour "
"être traitée."
#: ../Doc/bugs.rst:30
msgid "`Documentation bugs`_"
msgstr "`Bogues de documentation`_"
#: ../Doc/bugs.rst:30
msgid ""
"A list of documentation bugs that have been submitted to the Python issue "
"tracker."
msgstr ""
"Liste des bogues de documentation soumis à l'outil de suivi des problèmes "
"Python."
#: ../Doc/bugs.rst:33
msgid "`Issue Tracking <https://devguide.python.org/tracker/>`_"
msgstr "`Outil de suivi des problèmes <https://devguide.python.org/tracker/>`_"
#: ../Doc/bugs.rst:33
msgid ""
"Overview of the process involved in reporting an improvement on the tracker."
msgstr ""
"Vue d'ensemble du processus pour proposer une amélioration avec l'outil de "
"suivi."
#: ../Doc/bugs.rst:35
msgid ""
"`Helping with Documentation <https://devguide.python.org/docquality/#helping-"
"with-documentation>`_"
msgstr ""
"`Aider avec la documentation <https://devguide.python.org/docquality/"
"#helping-with-documentation>`_"
#: ../Doc/bugs.rst:36
msgid ""
"Comprehensive guide for individuals that are interested in contributing to "
"Python documentation."
msgstr "Guide complet pour qui souhaite contribuer à la documentation Python."
#: ../Doc/bugs.rst:41
msgid "Using the Python issue tracker"
msgstr "Utilisation du gestionnaire de tickets Python"
#: ../Doc/bugs.rst:43
msgid ""
"Bug reports for Python itself should be submitted via the Python Bug Tracker "
"(https://bugs.python.org/). The bug tracker offers a Web form which allows "
"pertinent information to be entered and submitted to the developers."
msgstr ""
"Les rapports de bogues pour Python lui-même devraient être soumis via le "
"*Bug Tracker Python* (http://bugs.python.org/). Le gestionnaire de tickets "
"propose un formulaire Web permettant de saisir des informations pertinentes "
"à soumettre aux développeurs."
#: ../Doc/bugs.rst:47
msgid ""
"The first step in filing a report is to determine whether the problem has "
"already been reported. The advantage in doing so, aside from saving the "
"developers time, is that you learn what has been done to fix it; it may be "
"that the problem has already been fixed for the next release, or additional "
"information is needed (in which case you are welcome to provide it if you "
"can!). To do this, search the bug database using the search box on the top "
"of the page."
msgstr ""
"La première étape pour remplir un rapport est de déterminer si le problème a "
"déjà été rapporté. L'avantage de cette approche, en plus d'économiser du "
"temps aux développeurs, est d'apprendre ce qui a été fait pour le résoudre ; "
"il se peut que le problème soit déjà résolu dans la prochaine version, ou "
"que des informations complémentaires soient attendues (auquel cas votre "
"contribution est la bienvenue !). Pour ce faire, cherchez dans la base de "
"données de bogues grâce à la boîte de recherche en haut de la page."
#: ../Doc/bugs.rst:54
msgid ""
"If the problem you're reporting is not already in the bug tracker, go back "
"to the Python Bug Tracker and log in. If you don't already have a tracker "
"account, select the \"Register\" link or, if you use OpenID, one of the "
"OpenID provider logos in the sidebar. It is not possible to submit a bug "
"report anonymously."
msgstr ""
"Si le problème que vous soumettez n'est pas déjà dans le *bug tracker*, "
"revenez au *Python Bug Tracker* et connectez-vous. Si vous n'avez pas déjà "
"un compte pour le *tracker*, cliquez sur le lien « S'enregistrer », ou, si "
"vous utilisez *OpenID*, sur l'un des logos des fournisseurs *OpenID* dans la "
"barre latérale. Il n'est pas possible de soumettre un rapport de bogue de "
"manière anonyme."
#: ../Doc/bugs.rst:59
msgid ""
"Being now logged in, you can submit a bug. Select the \"Create New\" link "
"in the sidebar to open the bug reporting form."
msgstr ""
"Une fois identifié, pour pouvez rapporter un bogue. Sélectionnez le lien "
"*Create New* dans la barre latérale pour ouvrir un nouveau formulaire de "
"rapport de bogue."
#: ../Doc/bugs.rst:62
msgid ""
"The submission form has a number of fields. For the \"Title\" field, enter "
"a *very* short description of the problem; less than ten words is good. In "
"the \"Type\" field, select the type of your problem; also select the "
"\"Component\" and \"Versions\" to which the bug relates."
msgstr ""
"Le formulaire de soumission a un certain nombre de champs. Pour le champ "
 Titre », saisissez une *très* courte description du problème ; moins de "
"dix mots est approprié. Dans le champ « Type », sélectionnez le type de "
"problème ; sélectionnez aussi « Composant » et « Versions » en rapport avec "
"le bogue."
#: ../Doc/bugs.rst:67
msgid ""
"In the \"Comment\" field, describe the problem in detail, including what you "
"expected to happen and what did happen. Be sure to include whether any "
"extension modules were involved, and what hardware and software platform you "
"were using (including version information as appropriate)."
msgstr ""
"Dans le champ « Commentaire », décrivez le problème de manière détaillée, "
"incluant ce à quoi vous vous attendiez et ce qui s'est vraiment produit. "
"Assurez-vous d'y inclure les éventuels modules d'extensions impliqués et la "
"plateforme matérielle et logicielle vous utilisiez (en incluant les "
"informations de versions)."
#: ../Doc/bugs.rst:72
msgid ""
"Each bug report will be assigned to a developer who will determine what "
"needs to be done to correct the problem. You will receive an update each "
"time action is taken on the bug."
msgstr ""
"Chaque bogue sera attribué à un développeur qui déterminera ce qui est "
"nécessaire d'entreprendre pour corriger le problème. Vous recevrez une "
"notification à chaque action effectuée sur le bogue."
#: ../Doc/bugs.rst:81
msgid ""
"`How to Report Bugs Effectively <https://www.chiark.greenend.org.uk/"
"~sgtatham/bugs.html>`_"
msgstr ""
"`Comment signaler des bogues de manière efficace <https://www.chiark."
"greenend.org.uk/~sgtatham/bugs.html>`_ (en anglais)"
#: ../Doc/bugs.rst:80
msgid ""
"Article which goes into some detail about how to create a useful bug report. "
"This describes what kind of information is useful and why it is useful."
msgstr ""
"Article qui entre dans les détails sur la manière de créer un rapport de "
"bogue utile. Il décrit quel genre d'information est utile et pourquoi elle "
"est utile."
#: ../Doc/bugs.rst:84
msgid ""
"`Bug Report Writing Guidelines <https://developer.mozilla.org/en-US/docs/"
"Mozilla/QA/Bug_writing_guidelines>`_"
msgstr ""
"`Guide pour la rédaction de rapports de bogues <https://developer.mozilla."
"org/en-US/docs/Mozilla/QA/Bug_writing_guidelines>`_"
#: ../Doc/bugs.rst:84
msgid ""
"Information about writing a good bug report. Some of this is specific to "
"the Mozilla project, but describes general good practices."
msgstr ""
"Conseils pour écrire un bon rapport de bogue. Certains sont spécifiques au "
"projet Mozilla mais présentent des bonnes pratiques générales."
#: ../Doc/bugs.rst:90
msgid "Getting started contributing to Python yourself"
msgstr "Commencer à contribuer à Python vous-même"
#: ../Doc/bugs.rst:92
msgid ""
"Beyond just reporting bugs that you find, you are also welcome to submit "
"patches to fix them. You can find more information on how to get started "
"patching Python in the `Python Developer's Guide`_. If you have questions, "
"the `core-mentorship mailing list`_ is a friendly place to get answers to "
"any and all questions pertaining to the process of fixing issues in Python."
msgstr ""

2773
tests/fixtures/python-docs-fr/glossary.po vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,331 @@
# Copyright (C) 2001-2018, Python Software Foundation
# For licence information, see README file.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-15 18:54+0100\n"
"PO-Revision-Date: 2018-09-28 10:04+0200\n"
"Last-Translator: Mickaël Bergem <suixo@securem.eu>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.9\n"
#: ../Doc/library/token.rst:2
msgid ":mod:`token` --- Constants used with Python parse trees"
msgstr ""
":mod:`token` --- Constantes utilisées avec les arbres d'analyse Python "
"(*parse trees*)"
#: ../Doc/library/token.rst:9
msgid "**Source code:** :source:`Lib/token.py`"
msgstr "**Code source :** :source:`Lib/token.py`"
#: ../Doc/library/token.rst:13
msgid ""
"This module provides constants which represent the numeric values of leaf "
"nodes of the parse tree (terminal tokens). Refer to the file :file:`Grammar/"
"Grammar` in the Python distribution for the definitions of the names in the "
"context of the language grammar. The specific numeric values which the "
"names map to may change between Python versions."
msgstr ""
"Ce module fournit des constantes qui représentent les valeurs numériques des "
"nœuds enfants du *parse tree* (les jetons \"terminaux\"). Voir le fichier :"
"file:`Grammar/Grammar` dans la distribution Python pour la définitions des "
"noms dans le contexte de la grammaire. Les valeurs numériques correspondant "
"aux noms sont susceptibles de changer entre deux versions de Python."
#: ../Doc/library/token.rst:19
msgid ""
"The module also provides a mapping from numeric codes to names and some "
"functions. The functions mirror definitions in the Python C header files."
msgstr ""
"Le module fournit également une correspondance entre les codes numériques et "
"les noms et certaines fonctions. Les fonctions reflètent les définitions des "
"fichiers d'en-tête C de Python."
#: ../Doc/library/token.rst:25
msgid ""
"Dictionary mapping the numeric values of the constants defined in this "
"module back to name strings, allowing more human-readable representation of "
"parse trees to be generated."
msgstr ""
"Dictionnaire faisant correspondre les valeurs numériques des constantes "
"définies dans ce module à leurs noms, permettant de générer une "
"représentation plus humaine des arbres syntaxiques."
#: ../Doc/library/token.rst:32
#, fuzzy
msgid "Return ``True`` for terminal token values."
msgstr "Renvoie ``True`` pour les valeurs des jetons terminaux."
#: ../Doc/library/token.rst:37
#, fuzzy
msgid "Return ``True`` for non-terminal token values."
msgstr "Renvoie ``True`` pour les valeurs des jetons non terminaux."
#: ../Doc/library/token.rst:42
#, fuzzy
msgid "Return ``True`` if *x* is the marker indicating the end of input."
msgstr ""
"Renvoie ``True`` si *x* est le marqueur indiquant la fin de de la source."
#: ../Doc/library/token.rst:45
msgid "The token constants are:"
msgstr "Les constantes associées aux jetons sont :"
#: ../Doc/library/token-list.inc:18
msgid "Token value for ``\"(\"``."
msgstr ""
#: ../Doc/library/token-list.inc:22
msgid "Token value for ``\")\"``."
msgstr ""
#: ../Doc/library/token-list.inc:26
msgid "Token value for ``\"[\"``."
msgstr ""
#: ../Doc/library/token-list.inc:30
msgid "Token value for ``\"]\"``."
msgstr ""
#: ../Doc/library/token-list.inc:34
msgid "Token value for ``\":\"``."
msgstr ""
#: ../Doc/library/token-list.inc:38
msgid "Token value for ``\",\"``."
msgstr ""
#: ../Doc/library/token-list.inc:42
msgid "Token value for ``\";\"``."
msgstr ""
#: ../Doc/library/token-list.inc:46
msgid "Token value for ``\"+\"``."
msgstr ""
#: ../Doc/library/token-list.inc:50
msgid "Token value for ``\"-\"``."
msgstr ""
#: ../Doc/library/token-list.inc:54
msgid "Token value for ``\"*\"``."
msgstr ""
#: ../Doc/library/token-list.inc:58
msgid "Token value for ``\"/\"``."
msgstr ""
#: ../Doc/library/token-list.inc:62
msgid "Token value for ``\"|\"``."
msgstr ""
#: ../Doc/library/token-list.inc:66
msgid "Token value for ``\"&\"``."
msgstr ""
#: ../Doc/library/token-list.inc:70
msgid "Token value for ``\"<\"``."
msgstr ""
#: ../Doc/library/token-list.inc:74
msgid "Token value for ``\">\"``."
msgstr ""
#: ../Doc/library/token-list.inc:78
msgid "Token value for ``\"=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:82
msgid "Token value for ``\".\"``."
msgstr ""
#: ../Doc/library/token-list.inc:86
msgid "Token value for ``\"%\"``."
msgstr ""
#: ../Doc/library/token-list.inc:90
msgid "Token value for ``\"{\"``."
msgstr ""
#: ../Doc/library/token-list.inc:94
msgid "Token value for ``\"}\"``."
msgstr ""
#: ../Doc/library/token-list.inc:98
msgid "Token value for ``\"==\"``."
msgstr ""
#: ../Doc/library/token-list.inc:102
msgid "Token value for ``\"!=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:106
msgid "Token value for ``\"<=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:110
msgid "Token value for ``\">=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:114
msgid "Token value for ``\"~\"``."
msgstr ""
#: ../Doc/library/token-list.inc:118
msgid "Token value for ``\"^\"``."
msgstr ""
#: ../Doc/library/token-list.inc:122
msgid "Token value for ``\"<<\"``."
msgstr ""
#: ../Doc/library/token-list.inc:126
msgid "Token value for ``\">>\"``."
msgstr ""
#: ../Doc/library/token-list.inc:130
msgid "Token value for ``\"**\"``."
msgstr ""
#: ../Doc/library/token-list.inc:134
msgid "Token value for ``\"+=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:138
msgid "Token value for ``\"-=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:142
msgid "Token value for ``\"*=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:146
msgid "Token value for ``\"/=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:150
msgid "Token value for ``\"%=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:154
msgid "Token value for ``\"&=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:158
msgid "Token value for ``\"|=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:162
msgid "Token value for ``\"^=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:166
msgid "Token value for ``\"<<=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:170
msgid "Token value for ``\">>=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:174
msgid "Token value for ``\"**=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:178
msgid "Token value for ``\"//\"``."
msgstr ""
#: ../Doc/library/token-list.inc:182
msgid "Token value for ``\"//=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:186
msgid "Token value for ``\"@\"``."
msgstr ""
#: ../Doc/library/token-list.inc:190
msgid "Token value for ``\"@=\"``."
msgstr ""
#: ../Doc/library/token-list.inc:194
msgid "Token value for ``\"->\"``."
msgstr ""
#: ../Doc/library/token-list.inc:198
msgid "Token value for ``\"...\"``."
msgstr ""
#: ../Doc/library/token-list.inc:202
msgid "Token value for ``\":=\"``."
msgstr ""
#: ../Doc/library/token.rst:49
msgid ""
"The following token type values aren't used by the C tokenizer but are "
"needed for the :mod:`tokenize` module."
msgstr ""
"Les types de jetons suivants ne sont pas utilisés par l'analyseur lexical C "
"mais sont requis par le module :mod:`tokenize`."
#: ../Doc/library/token.rst:54
msgid "Token value used to indicate a comment."
msgstr "Valeur du jeton utilisée pour indiquer un commentaire."
#: ../Doc/library/token.rst:59
msgid ""
"Token value used to indicate a non-terminating newline. The :data:`NEWLINE` "
"token indicates the end of a logical line of Python code; ``NL`` tokens are "
"generated when a logical line of code is continued over multiple physical "
"lines."
msgstr ""
"Valeur du jeton utilisée pour indiquer un retour à la ligne non terminal. Le "
"jeton :data:`NEWLINE` indique la fin d'une ligne logique de code Python; les "
"jetons ``NL`` sont générés quand une ligne logique de code s'étend sur "
"plusieurs lignes."
#: ../Doc/library/token.rst:67
msgid ""
"Token value that indicates the encoding used to decode the source bytes into "
"text. The first token returned by :func:`tokenize.tokenize` will always be "
"an ``ENCODING`` token."
msgstr ""
"Valeur de jeton qui indique l'encodage utilisé pour décoder le fichier "
"initial. Le premier jeton renvoyé par :func:`tokenize.tokenize` sera "
"toujours un jeton ``ENCODING``."
#: ../Doc/library/token.rst:74
msgid ""
"Token value indicating that a type comment was recognized. Such tokens are "
"only produced when :func:`ast.parse()` is invoked with "
"``type_comments=True``."
msgstr ""
#: ../Doc/library/token.rst:79
msgid "Added :data:`AWAIT` and :data:`ASYNC` tokens."
msgstr "Ajout des jetons :data:`AWAIT` et :data:`ASYNC`."
#: ../Doc/library/token.rst:82
msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens."
msgstr "Ajout des jetons :data:`COMMENT`, :data:`NL` et :data:`ENCODING`."
#: ../Doc/library/token.rst:85
msgid ""
"Removed :data:`AWAIT` and :data:`ASYNC` tokens. \"async\" and \"await\" are "
"now tokenized as :data:`NAME` tokens."
msgstr ""
"Suppression des jetons :data:`AWAIT` et :data:`ASYNC`. ``async`` et "
"``await`` sont maintenant transformés en jetons :data:`NAME`."
#: ../Doc/library/token.rst:89
msgid ""
"Added :data:`TYPE_COMMENT`. Added :data:`AWAIT` and :data:`ASYNC` tokens "
"back (they're needed to support parsing older Python versions for :func:`ast."
"parse` with ``feature_version`` set to 6 or lower)."
msgstr ""

24
tests/test_potodo.py Normal file
View File

@ -0,0 +1,24 @@
from pathlib import Path
from potodo.potodo import exec_potodo
FIXTURE_DIR = Path(__file__).resolve().parent / "fixtures"
def test_potodo(capsys):
exec_potodo(
path=FIXTURE_DIR / "python-docs-fr",
above=0,
below=100,
fuzzy=False,
hide_reserved=False,
counts=False,
offline=True,
)
captured = capsys.readouterr()
assert "bugs.po" in captured.out
assert "# library" in captured.out
assert "token.po" in captured.out
assert "glossary.po" not in captured.out
assert "sphinx.po" not in captured.out

22
tox.ini Normal file
View File

@ -0,0 +1,22 @@
[flake8]
max-line-length = 88
[tox]
envlist = py36, py37, py38, flake8, mypy, black
skip_missing_interpreters = True
[testenv]
deps = pytest
commands = pytest
[testenv:flake8]
deps = flake8
commands = flake8 tests/ potodo/
[testenv:black]
deps = black
commands = black --check --diff tests/ potodo/
[testenv:mypy]
deps = mypy
commands = mypy --ignore-missing-imports potodo/