Merge pull request #104 from AFPy/readme-update

This commit is contained in:
Jules Lasne 2020-11-26 15:32:14 +01:00 committed by GitHub
commit 077f43aaa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 60 additions and 45 deletions

View File

@ -5,7 +5,7 @@ name: Upload Python Package
on:
release:
types: [created]
types: [created, published, edited]
jobs:
deploy:

View File

@ -1,30 +1,39 @@
name: Tox tests
name: Tests
on:
push:
branches:
- '*'
- master
pull_request:
branches:
- '*'
- master
jobs:
build:
runs-on: ubuntu-latest
test:
name: Run tox on ${{ matrix.os }} for Python ${{ matrix.tox.py_version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]
tox:
- py_version: '3.6'
env: py36
- py_version: '3.7'
env: py37
- py_version: '3.8'
env: py38,flake8,mypy,black
- py_version: '3.9'
env: py39
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.tox.py_version }}
- uses: actions/cache@v2
with:
path: .tox
key: ${{ matrix.os }}-${{ matrix.tox.python-version }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('requirements-dev.txt') }}
- name: Install tox
run: python3 -m pip install tox
- name: Run tox
run: tox -q -p all -e ${{ matrix.tox.env }}

View File

@ -1,8 +1,10 @@
# Potodo
[![Build Status](https://travis-ci.com/Seluj78/Potodo.svg?branch=master)](https://travis-ci.com/Seluj78/Potodo)
![Build status](https://github.com/AFPy/Potodo/workflows/Tox%20tests/badge.svg)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
![PyPI](https://img.shields.io/pypi/v/potodo)
Potodo, a (almost) flawless TODO/progress listing CLI tool for po files.
### Potodo is part of poutils!

View File

@ -2,4 +2,4 @@
__author__ = """Jules Lasne"""
__email__ = "jules.lasne@gmail.com"
__version__ = "0.19.0"
__version__ = "0.19.1"

View File

@ -1,11 +1,11 @@
import logging
from tempfile import NamedTemporaryFile
import os
import pickle
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Any
from typing import cast
from typing import Dict
from typing import Any
from potodo import __version__ as VERSION
from potodo.po_file import PoFileStats

View File

@ -29,7 +29,9 @@ def get_repo_url(repo_path: Path) -> str:
stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError:
print("potodo needs to be ran in a git repository, or use the `-p` `--path` argument.")
print(
"potodo needs to be ran in a git repository, or use the `-p` `--path` argument."
)
exit(1)
logging.debug("Found repo url %s from %s", url, repo_path)
return url

View File

@ -1,9 +1,9 @@
import webbrowser
from pathlib import Path
from typing import Callable
from typing import cast
from typing import Iterable
from typing import List
from typing import Callable
import webbrowser
from simple_term_menu import TerminalMenu

View File

@ -2,14 +2,14 @@ import itertools
import logging
import os
from pathlib import Path
from typing import Any
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import List
from typing import Mapping
from typing import Sequence
from typing import Set
from typing import Callable
from typing import Any
import polib

View File

@ -8,12 +8,12 @@ from typing import Dict
from typing import List
from typing import Sequence
from typing import Tuple
from gitignore_parser import parse_gitignore
from potodo import __version__
from potodo.arguments_handling import check_args
from potodo.github import get_issue_reservations
from potodo.json import json_dateconv
from potodo.logging import setup_logging
from potodo.po_file import get_po_stats_from_repo_or_cache
@ -110,7 +110,7 @@ def non_interactive_output(
buffer: List[Any] = []
folder_stats: Dict[str, int] = {"translated": 0, "total": 0}
printed_list: List[bool] = []
for po_file in sorted(po_files):
# For each file in those files from that directory
if not only_fuzzy or po_file.fuzzy_entries:
@ -131,17 +131,15 @@ def non_interactive_output(
show_reservation_dates,
matching_files,
)
# Once all files have been processed, print the dir and the files
# or store them into a dict to print them once all directories have
# been processed.
if json_format:
add_dir_stats(
directory_name, buffer, folder_stats, printed_list, dir_stats
)
add_dir_stats(directory_name, buffer, folder_stats, printed_list, dir_stats)
else:
print_dir_stats(directory_name, buffer, folder_stats, printed_list)
total_translated += folder_stats["translated"]
total_entries += folder_stats["total"]
@ -156,8 +154,9 @@ def non_interactive_output(
)
)
else:
total_completion = 100 * total_translated / total_entries
print(f"\n\n# TOTAL ({total_completion:.2f}% done)\n")
if total_entries != 0:
total_completion = 100 * total_translated / total_entries
print(f"\n\n# TOTAL ({total_completion:.2f}% done)\n")
def exec_potodo(
@ -206,6 +205,7 @@ def exec_potodo(
if is_interactive:
from potodo.interactive import interactive_output
interactive_output(path, exclude, ignore_matches)
else:
non_interactive_output(

9
requirements-dev.txt Normal file
View File

@ -0,0 +1,9 @@
polib==1.1.0
requests==2.25.0
simple-term-menu==0.10.4
gitignore_parser==0.0.8
tox
virtualenv
flake8
mypy
black

View File

@ -5,13 +5,6 @@ extend-ignore = E501 # line length handled by black.
envlist = py36, py37, py38, py39, flake8, mypy, black
skip_missing_interpreters = True
[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38, mypy, flake8, black
3.9: py39, mypy, flake8, black
[testenv]
deps =
pytest