Giter Club home page Giter Club logo

potodo's People

Contributors

allcontributors[bot] avatar awecx avatar dependabot-preview[bot] avatar dependabot[bot] avatar eviau avatar gaasmann avatar grenoya avatar julienpalard avatar seluj78 avatar vpoulailleau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

potodo's Issues

Clarify `print_list`

The print_list list is confusing and needs to be clarified.

A better name, another implementation to know what folder to print ? we'll see

What is cache_args?

I don't understand what this variable is. But it looks a good source of "full caches reset", which looks bad to me.

Add a cache option

Cache would be stored in like ~/.potodo/cache.json, and it would contain the last refresh date and refresh every month or something ? The reservations would still be updated everytime the command is ran

do not use f-string

Some of our translator still have python 3.5 and then can't use polib. If you don't feel like to do it, I can do it. If so, assign it to me

--json option does not work

With the following traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/antoine/github/Potodo/potodo/__main__.py", line 3, in <module>
    __import__("potodo.potodo").potodo.main()
  File "/home/antoine/github/Potodo/potodo/potodo.py", line 305, in main
    exec_potodo(**vars(args))
TypeError: exec_potodo() got an unexpected keyword argument 'json'

Améliorations JSON

[
        {
            "name": "folder/",
            "percent_translated": 0.0,
            "files": [
                {
                    "name": "folder/file3",
                    "path": "some/path/folder/file3.po",
                    "entries": 1,
                    "fuzzies": 0,
                    "translated": 0,
                    "percent_translated": 0,
                    "reserved_by": null,
                },
            ],
        },
        {
            "name": "python-docs-fr/",
            "percent_translated": 25,
            "files": [
                {
                    "name": "python-docs-fr/file1",
                    "path": "some/path/file1.po",
                    "entries": 3,
                    "fuzzies": 1,
                    "translated": 1,
                    "percent_translated": 33,
                    "reserved_by": null,
                },
                {
                    "name": "python-docs-fr/file2",
                    "path": "some/path/file2.po",
                    "entries": 1,
                    "fuzzies": 0,
                    "translated": 0,
                    "percent_translated": 0,
                    "reserved_by": null,
                },
            ],
        },
    ]

Il y a 2-3 trucs à améliorer sur la sortie ;

  • on pourrait mettre « / » au lieu de « python-docs-fr » pour désigner le dossier racine ;
  • mettre le « percent_translated » du fichier en décimal ;
  • enrichir la description du dossier avec « entries », « fuzzies », « translated » aggrégés.

Originally posted by @awecx in #45 (comment)

EDIT 31/12/20, percent_translated sur les dossiers correct.
EDIT 04/01/21, entries », « fuzzies », « translated » aggrégés.

Math error

Using the repository: https://github.com/raulcd/python-docs-es
And the command: potodo --offline --path c-api/
I find strange results in c-api:

# c-api (47.03% done)

- abstract.po                      3 /   3 (100.0% translated)
- allocation.po                    9 /   9 (100.0% translated)
- apiabiversion.po                22 /  22 (100.0% translated)
- arg.po                           0 / 192 (  0.0% translated)
- bool.po                          8 /   8 (100.0% translated)
- buffer.po                        0 / 102 (  0.0% translated)
- bytearray.po                    17 /  17 (100.0% translated)
- bytes.po                         0 /  60 (  0.0% translated)
- capsule.po                       0 /  29 (  0.0% translated)
- cell.po                         10 /  10 (100.0% translated)
- code.po                          9 /   9 (100.0% translated)
- codec.po                         0 /  27 (  0.0% translated)
- complex.po                       0 /  25 (  0.0% translated)
- concrete.po                     11 /  11 (100.0% translated)
- contextvars.po                   0 /  31 (  0.0% translated)
- conversion.po                   22 /  27 ( 81.0% translated), 5 fuzzy
- coro.po                          0 /   6 (  0.0% translated)
- datetime.po                      0 /  41 (  0.0% translated)
- descriptor.po                    4 /   4 (100.0% translated)
- dict.po                          0 /  31 (  0.0% translated)
- exceptions.po                    0 / 261 (  0.0% translated)
- file.po                          0 /  15 (  0.0% translated)
- float.po                        14 /  14 (100.0% translated)
- function.po                     18 /  18 (100.0% translated)
- gcsupport.po                     0 /  25 (  0.0% translated)
- gen.po                           8 /   8 (100.0% translated)
- import.po                        0 /  44 (  0.0% translated)
- index.po                         2 /   2 (100.0% translated)
- init.po                          0 / 287 (  0.0% translated)
- init_config.po                   0 / 274 (  0.0% translated)
- intro.po                         0 /  92 (  0.0% translated)
- iter.po                          5 /   5 (100.0% translated)
- iterator.po                      8 /   8 (100.0% translated)
- list.po                          0 /  23 (  0.0% translated)
- long.po                          0 /  52 (  0.0% translated)
- mapping.po                      15 /  15 (100.0% translated)
- marshal.po                      15 /  15 (100.0% translated)
- memory.po                        0 / 150 (  0.0% translated)
- memoryview.po                    8 /   9 ( 88.0% translated), 1 fuzzy
- method.po                       17 /  17 (100.0% translated)
- module.po                        0 /  87 (  0.0% translated)
- none.po                          4 /   4 (100.0% translated)
- number.po                        0 /  41 (  0.0% translated)
- objbuffer.po                     8 /   8 (100.0% translated)
- object.po                        0 /  77 (  0.0% translated)
- objimpl.po                       2 /   2 (100.0% translated)
- refcounting.po                  11 /  11 (100.0% translated)
- reflection.po                    8 /   8 (100.0% translated)
- sequence.po                      0 /  27 (  0.0% translated)
- set.po                           0 /  23 (  0.0% translated)
- slice.po                         0 /  20 (  0.0% translated)
- stable.po                        6 /   6 (100.0% translated)
- structures.po                    0 / 112 (  0.0% translated)
- sys.po                           0 /  69 (  0.0% translated)
- tuple.po                         0 /  48 (  0.0% translated)
- type.po                          0 /  52 (  0.0% translated)
- typeobj.po                       0 / 586 (  0.0% translated)
- unicode.po                       0 / 332 (  0.0% translated)
- utilities.po                     2 /   2 (100.0% translated)
- veryhigh.po                     61 /  61 (100.0% translated)
- weakref.po                      10 /  10 (100.0% translated)

(Yes it's a patched version of potodo that displays 100.0% translated lines also, to better see the issue)

It indicates ~47% is done, but visually I don't think so, so I checked and find 9%:

$ potodo --offline --path c-api/ | awk '{done += $3; all += $5} END {print 100 * done / all}'
9.4029

9% makes more sense when we count translated and untranslated entries:

$ msgcat c-api/*.po | msgattrib --translated | grep -c '^msgid'
343
(python-docs-es) mdk@seraph:~/clones/python/python-docs-es (3.8)
$ msgcat c-api/*.po | grep -c '^msgid'
3508

there's 343/3508 entries translated, roughly 10%, so the 9.4% looks right, the 47% looks wrong.

Oh, is it 47% of files done? Maybe not:

$ potodo --offline --path c-api/ | grep -c ^-
61
$ potodo --offline --path c-api/ | grep -c 100.0%
27
$ python3
>>> 100 * 27 / 61
44.26229508196721

false classifiers in setup.py

setup.py has classissifier python3.5but this can't be true since the code includes f-strings. So that classifier should be removed. Does potodo run on Python 3.6 ?

Replace all string file paths into `Path` objects.

Edited

_Originally posted by @JulienPalard in https://github.com/Seluj78/Potodo/pull/48/files#r366526201

Non tu ne semble pas avoir raté grand chose. C'est juste dommage de les transformer en str après, probablement un souci de compat python 3.5 ou 3.6 j'imagine. => we're dropping support for 3.5

Il faudrait tenter de faire l'effort contraire dans une autre PR peut être : la garder en Path le plus loin possible. Typique cette str est re-transformé en Path dans pofile.py a la ligne 60.

Potodo cannot be executed with github enabled remotely

(python-docs-i18n) ➜  ~ potodo -p Projects/python-docs-fr
Traceback (most recent call last):
  File "/Users/seluj78/.venvs/python-docs-i18n/bin/potodo", line 8, in <module>
    sys.exit(main())
  File "/Users/seluj78/.venvs/python-docs-i18n/lib/python3.7/site-packages/potodo/potodo.py", line 232, in main
    args.no_reserved,
  File "/Users/seluj78/.venvs/python-docs-i18n/lib/python3.7/site-packages/potodo/potodo.py", line 78, in exec_potodo
    issue_reservations = get_gh_issue_reservation()
  File "/Users/seluj78/.venvs/python-docs-i18n/lib/python3.7/site-packages/potodo/potodo.py", line 21, in get_gh_issue_reservation
    issues = requests.get("https://api.github.com/repos/" + get_repo_name() + "/issues").json()
  File "/Users/seluj78/.venvs/python-docs-i18n/lib/python3.7/site-packages/potodo/_github.py", line 14, in get_repo_name
    repo_url: str = get_repo_url()
  File "/Users/seluj78/.venvs/python-docs-i18n/lib/python3.7/site-packages/potodo/_github.py", line 9, in get_repo_url
    raise ValueError(f"Unknown error. `git get-url --all upstream|origin` returned {url}")
ValueError: Unknown error. `git get-url --all upstream|origin` returned fatal: not a git repository (or any of the parent directories): .git
(python-docs-i18n) ➜  ~

Idea for a strategy to find the repo from the remote list

Idea for a strategy to find the repo from the remote list:

  • List all remotes
  • Filter by keeping only the ones targeting github.com
  • Hit the first one on the github API (https://api.github.com/repos/{the_repo})
  • See if it has a "parent" attribute:
    • it it has one, the good one is the parent, and we have the github URL. no longer need to care about knowing its local name.
    • if it has none, lucky you it's the right one

Demo of finding it indirectly:

$ curl https://api.github.com/repos/seluj78/python-docs-fr | jq .parent.url
"https://api.github.com/repos/python/python-docs-fr"

Or demo of lucky "it was the right one so it has no parent":

$ curl https://api.github.com/repos/python/python-docs-fr | jq .parent.url
null

Originally posted by @JulienPalard in #37 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.