Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #104 from AFPy/readme-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Seluj78 authored Nov 26, 2020
2 parents 4de5f0e + b6e13b4 commit 077f43a
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Upload Python Package

on:
release:
types: [created]
types: [created, published, edited]

jobs:
deploy:
Expand Down
47 changes: 28 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
2 changes: 1 addition & 1 deletion potodo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Jules Lasne"""
__email__ = "[email protected]"
__version__ = "0.19.0"
__version__ = "0.19.1"
4 changes: 2 additions & 2 deletions potodo/cache.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion potodo/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions potodo/interactive.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions potodo/po_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
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

Expand Down
18 changes: 9 additions & 9 deletions potodo/potodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
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
Expand Down Expand Up @@ -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:
Expand All @@ -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"]

Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 077f43a

Please sign in to comment.