diff --git a/python/word-count b/python/word-count deleted file mode 120000 index 265bebac..00000000 --- a/python/word-count +++ /dev/null @@ -1 +0,0 @@ -wordcount \ No newline at end of file diff --git a/python/wordcount/.coverage b/python/word-count/.coverage similarity index 99% rename from python/wordcount/.coverage rename to python/word-count/.coverage index e6553f0b..5df1bbb7 100644 Binary files a/python/wordcount/.coverage and b/python/word-count/.coverage differ diff --git a/python/wordcount/.coverage.xml b/python/word-count/.coverage.xml similarity index 93% rename from python/wordcount/.coverage.xml rename to python/word-count/.coverage.xml index bdf234f3..86b93216 100644 --- a/python/wordcount/.coverage.xml +++ b/python/word-count/.coverage.xml @@ -1,9 +1,9 @@ - - + + - /home/vpayno/git_vpayno/exercism-workspace/python/wordcount + /home/vpayno/git_vpayno/exercism-workspace/python/word-count diff --git a/python/wordcount/.coveragerc b/python/word-count/.coveragerc similarity index 100% rename from python/wordcount/.coveragerc rename to python/word-count/.coveragerc diff --git a/python/wordcount/.exercism/config.json b/python/word-count/.exercism/config.json similarity index 100% rename from python/wordcount/.exercism/config.json rename to python/word-count/.exercism/config.json diff --git a/python/wordcount/.exercism/metadata.json b/python/word-count/.exercism/metadata.json similarity index 100% rename from python/wordcount/.exercism/metadata.json rename to python/word-count/.exercism/metadata.json diff --git a/python/wordcount/HELP.md b/python/word-count/HELP.md similarity index 100% rename from python/wordcount/HELP.md rename to python/word-count/HELP.md diff --git a/python/wordcount/HINTS.md b/python/word-count/HINTS.md similarity index 100% rename from python/wordcount/HINTS.md rename to python/word-count/HINTS.md diff --git a/python/wordcount/README.md b/python/word-count/README.md similarity index 100% rename from python/wordcount/README.md rename to python/word-count/README.md diff --git a/python/word-count/pytest.ini b/python/word-count/pytest.ini new file mode 100644 index 00000000..8dc12a49 --- /dev/null +++ b/python/word-count/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +pythonpath = . +addopts = --doctest-modules +markers = + task: exercise task/step diff --git a/python/word-count/run-tests-python.txt b/python/word-count/run-tests-python.txt new file mode 100644 index 00000000..7334d3aa --- /dev/null +++ b/python/word-count/run-tests-python.txt @@ -0,0 +1,203 @@ +Running automated test file(s): + + +=============================================================================== + +Running: pylint ./src + +------------------------------------------------------------------- +Your code has been rated at 10.00/10 (previous run: 9.63/10, +0.37) + + +real 0m0.954s +user 0m0.865s +sys 0m0.091s + +=============================================================================== + +Running: ruff check --ignore E501 ./src + +real 0m0.089s +user 0m0.033s +sys 0m0.060s + +=============================================================================== + +Running: pyright --stats ./src +Found 2 source files +pyright 1.1.347 +0 errors, 0 warnings, 0 informations +Completed in 0.611sec + +Analysis stats +Total files parsed and bound: 22 +Total files checked: 2 + +Timing stats +Find Source Files: 0sec +Read Source Files: 0sec +Tokenize: 0.04sec +Parse: 0.04sec +Resolve Imports: 0.06sec +Bind: 0.07sec +Check: 0.08sec +Detect Cycles: 0sec + +real 0m1.512s +user 0m1.258s +sys 0m0.181s + +=============================================================================== + +Running: bandit --verbose --recursive ./src +[main] INFO profile include tests: None +[main] INFO profile exclude tests: None +[main] INFO cli include tests: None +[main] INFO cli exclude tests: None +[main] INFO running on Python 3.12.1 +Run started:2024-01-17 05:51:31.087754 +Files in scope (2): + ./src/word_count/__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0}) + ./src/word_count/word_count.py (score: {SEVERITY: 0, CONFIDENCE: 0}) +Files excluded (0): + +Test results: + No issues identified. + +Code scanned: + Total lines of code: 21 + Total lines skipped (#nosec): 0 + Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0 + +Run metrics: + Total issues (by severity): + Undefined: 0 + Low: 0 + Medium: 0 + High: 0 + Total issues (by confidence): + Undefined: 0 + Low: 0 + Medium: 0 + High: 0 +Files skipped (0): + +real 0m0.297s +user 0m0.235s +sys 0m0.064s + +=============================================================================== + +Running: refurb ./src +src/word_count/word_count.py:21:5 [FURB184]: Assignment statement should be chained + +Run `refurb --explain ERR` to further explain an error. Use `--quiet` to silence this message + +real 0m1.176s +user 0m1.085s +sys 0m0.093s + +=============================================================================== + +python -m doctest -v ./src/word_count/__init__.py ./src/word_count/word_count.py +1 items had no tests: + __init__ +0 tests in 1 items. +0 passed and 0 failed. +Test passed. +2 items had no tests: + word_count + word_count.count_words +0 tests in 2 items. +0 passed and 0 failed. +Test passed. + +real 0m0.111s +user 0m0.056s +sys 0m0.055s + + +=============================================================================== + +==> .coveragerc <== +[run] +omit = __init__.py, *_test.py + +Running: PYTHONPATH=./src pytest --verbose --cov=. --cov-branch --cov-report=term-missing --cov-report=xml:.coverage.xml -p no:randomly ./test +============================= test session starts ============================== +platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0 -- /home/vpayno/.pyenv/versions/3.12.1/bin/python +cachedir: .pytest_cache +rootdir: /home/vpayno/git_vpayno/exercism-workspace/python/word-count +configfile: pytest.ini +plugins: anyio-4.2.0, libtmux-0.25.0, pylama-8.4.1, cov-4.1.0, datafiles-3.0.0, docker-2.0.1, subprocess-1.5.0, typeguard-4.1.5 +collecting ... collected 17 items + +test/word_count_test.py::WordCountTest::test_alternating_word_separators_not_detected_as_a_word PASSED [ 5%] +test/word_count_test.py::WordCountTest::test_count_one_of_each_word PASSED [ 11%] +test/word_count_test.py::WordCountTest::test_count_one_word PASSED [ 17%] +test/word_count_test.py::WordCountTest::test_handles_cramped_lists PASSED [ 23%] +test/word_count_test.py::WordCountTest::test_handles_expanded_lists PASSED [ 29%] +test/word_count_test.py::WordCountTest::test_ignore_punctuation PASSED [ 35%] +test/word_count_test.py::WordCountTest::test_include_numbers PASSED [ 41%] +test/word_count_test.py::WordCountTest::test_multiple_apostrophes_ignored PASSED [ 47%] +test/word_count_test.py::WordCountTest::test_multiple_occurrences_of_a_word PASSED [ 52%] +test/word_count_test.py::WordCountTest::test_multiple_spaces_not_detected_as_a_word PASSED [ 58%] +test/word_count_test.py::WordCountTest::test_non_alphanumeric PASSED [ 64%] +test/word_count_test.py::WordCountTest::test_normalize_case PASSED [ 70%] +test/word_count_test.py::WordCountTest::test_quotation_for_word_with_apostrophe PASSED [ 76%] +test/word_count_test.py::WordCountTest::test_substrings_from_the_beginning PASSED [ 82%] +test/word_count_test.py::WordCountTest::test_tabs PASSED [ 88%] +test/word_count_test.py::WordCountTest::test_with_apostrophes PASSED [ 94%] +test/word_count_test.py::WordCountTest::test_with_quotations PASSED [100%] + +---------- coverage: platform linux, python 3.12.1-final-0 ----------- +Name Stmts Miss Branch BrPart Cover Missing +----------------------------------------------------------- +word_count.py 16 0 6 0 100% +----------------------------------------------------------- +TOTAL 16 0 6 0 100% +Coverage XML written to file .coverage.xml + + +============================== 17 passed in 0.09s ============================== + +real 0m0.863s +user 0m0.718s +sys 0m0.143s + +=============================================================================== + +Running: coverage report --show-missing +Name Stmts Miss Branch BrPart Cover Missing +----------------------------------------------------------- +word_count.py 16 0 6 0 100% +----------------------------------------------------------- +TOTAL 16 0 6 0 100% + +real 0m0.170s +user 0m0.111s +sys 0m0.061s + +=============================================================================== + +coverage annotate + +real 0m0.158s +user 0m0.106s +sys 0m0.054s + +tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! ' + +> def count_words(sentence: str) -> Dict[str, int]: +> """Counts the number of times each word in a string is used. + +=============================================================================== + +Running: misspell ./src/word_count/__init__.py ./src/word_count/word_count.py + +real 0m0.020s +user 0m0.019s +sys 0m0.011s + +=============================================================================== + diff --git a/python/wordcount/__init__.py b/python/word-count/src/word_count/__init__.py similarity index 100% rename from python/wordcount/__init__.py rename to python/word-count/src/word_count/__init__.py diff --git a/python/word-count/src/word_count/word_count.py b/python/word-count/src/word_count/word_count.py new file mode 120000 index 00000000..593ce5f4 --- /dev/null +++ b/python/word-count/src/word_count/word_count.py @@ -0,0 +1 @@ +../../word_count.py \ No newline at end of file diff --git a/python/word-count/test/__init__.py b/python/word-count/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/python/word-count/test/word_count_test.py b/python/word-count/test/word_count_test.py new file mode 120000 index 00000000..3b57495d --- /dev/null +++ b/python/word-count/test/word_count_test.py @@ -0,0 +1 @@ +../word_count_test.py \ No newline at end of file diff --git a/python/wordcount/word_count.py b/python/word-count/word_count.py similarity index 100% rename from python/wordcount/word_count.py rename to python/word-count/word_count.py diff --git a/python/wordcount/word_count.py,cover b/python/word-count/word_count.py,cover similarity index 100% rename from python/wordcount/word_count.py,cover rename to python/word-count/word_count.py,cover diff --git a/python/wordcount/word_count_test.py b/python/word-count/word_count_test.py similarity index 100% rename from python/wordcount/word_count_test.py rename to python/word-count/word_count_test.py diff --git a/python/wordcount/run-tests-python.txt b/python/wordcount/run-tests-python.txt deleted file mode 100644 index 250318d5..00000000 --- a/python/wordcount/run-tests-python.txt +++ /dev/null @@ -1,195 +0,0 @@ -Running automated test file(s): - - -=============================================================================== - -Running: pylint --ignore-patterns (__init__|.*_test).py . - -real 0m0.412s -user 0m0.348s -sys 0m0.066s - -=============================================================================== - -Running: ruff check --ignore E501 ./__init__.py ./word_count.py ./word_count_test.py - -real 0m0.064s -user 0m0.030s -sys 0m0.036s - -=============================================================================== - -Running: pyright --stats . -Found 3 source files -pyright 1.1.315 -0 errors, 0 warnings, 0 informations -Completed in 0.687sec - -Analysis stats -Total files parsed and bound: 35 -Total files checked: 3 - -Timing stats -Find Source Files: 0sec -Read Source Files: 0.01sec -Tokenize: 0.05sec -Parse: 0.06sec -Resolve Imports: 0.04sec -Bind: 0.08sec -Check: 0.11sec -Detect Cycles: 0sec - -real 0m1.309s -user 0m1.460s -sys 0m0.145s - -=============================================================================== - -Running: bandit --verbose --recursive . -[main] INFO profile include tests: None -[main] INFO profile exclude tests: None -[main] INFO cli include tests: None -[main] INFO cli exclude tests: None -[main] INFO running on Python 3.11.3 -Run started:2023-06-26 06:51:23.040683 -Files in scope (3): - ./__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0}) - ./word_count.py (score: {SEVERITY: 0, CONFIDENCE: 0}) - ./word_count_test.py (score: {SEVERITY: 0, CONFIDENCE: 0}) -Files excluded (16): - ./.coverage - ./.coverage.xml - ./.coveragerc - ./.exercism/config.json - ./.exercism/metadata.json - ./.mypy_cache/.gitignore - ./.mypy_cache/3.11/@plugins_snapshot.json - ./.mypy_cache/CACHEDIR.TAG - ./HELP.md - ./HINTS.md - ./README.md - ./__pycache__/__init__.cpython-311.pyc - ./__pycache__/word_count.cpython-311.pyc - ./__pycache__/word_count_test.cpython-311-pytest-7.3.1.pyc - ./run-tests-python.txt - ./word_count.py,cover - -Test results: - No issues identified. - -Code scanned: - Total lines of code: 123 - Total lines skipped (#nosec): 0 - Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0 - -Run metrics: - Total issues (by severity): - Undefined: 0 - Low: 0 - Medium: 0 - High: 0 - Total issues (by confidence): - Undefined: 0 - Low: 0 - Medium: 0 - High: 0 -Files skipped (0): - -real 0m0.234s -user 0m0.184s -sys 0m0.051s - -=============================================================================== - -Running: refurb . - -real 0m1.312s -user 0m1.233s -sys 0m0.080s - -=============================================================================== - -==> .coveragerc <== -[run] -omit = __init__.py, *_test.py - -Running: pytest --verbose --cov=. --cov-branch --cov-report=term-missing --cov-report=xml:.coverage.xml -p no:randomly -============================= test session starts ============================== -platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 -- /home/vpayno/.pyenv/versions/3.11.3/bin/python -cachedir: .pytest_cache -rootdir: /home/vpayno/git_vpayno/exercism-workspace/python -configfile: pytest.ini -plugins: anyio-3.6.2, libtmux-0.21.1, pylama-8.4.1, cov-4.0.0, datafiles-3.0.0, docker-1.0.1, subprocess-1.5.0, typeguard-2.13.3 -collecting ... collected 17 items - -word_count_test.py::WordCountTest::test_alternating_word_separators_not_detected_as_a_word PASSED [ 5%] -word_count_test.py::WordCountTest::test_count_one_of_each_word PASSED [ 11%] -word_count_test.py::WordCountTest::test_count_one_word PASSED [ 17%] -word_count_test.py::WordCountTest::test_handles_cramped_lists PASSED [ 23%] -word_count_test.py::WordCountTest::test_handles_expanded_lists PASSED [ 29%] -word_count_test.py::WordCountTest::test_ignore_punctuation PASSED [ 35%] -word_count_test.py::WordCountTest::test_include_numbers PASSED [ 41%] -word_count_test.py::WordCountTest::test_multiple_apostrophes_ignored PASSED [ 47%] -word_count_test.py::WordCountTest::test_multiple_occurrences_of_a_word PASSED [ 52%] -word_count_test.py::WordCountTest::test_multiple_spaces_not_detected_as_a_word PASSED [ 58%] -word_count_test.py::WordCountTest::test_non_alphanumeric PASSED [ 64%] -word_count_test.py::WordCountTest::test_normalize_case PASSED [ 70%] -word_count_test.py::WordCountTest::test_quotation_for_word_with_apostrophe PASSED [ 76%] -word_count_test.py::WordCountTest::test_substrings_from_the_beginning PASSED [ 82%] -word_count_test.py::WordCountTest::test_tabs PASSED [ 88%] -word_count_test.py::WordCountTest::test_with_apostrophes PASSED [ 94%] -word_count_test.py::WordCountTest::test_with_quotations PASSED [100%] - ----------- coverage: platform linux, python 3.11.3-final-0 ----------- -Name Stmts Miss Branch BrPart Cover Missing ------------------------------------------------------------ -word_count.py 16 0 6 0 100% ------------------------------------------------------------ -TOTAL 16 0 6 0 100% -Coverage XML written to file .coverage.xml - - -============================== 17 passed in 0.05s ============================== - -real 0m0.945s -user 0m0.832s -sys 0m0.113s - -=============================================================================== - -Running: coverage report --show-missing -Name Stmts Miss Branch BrPart Cover Missing ------------------------------------------------------------ -word_count.py 16 0 6 0 100% ------------------------------------------------------------ -TOTAL 16 0 6 0 100% - -real 0m0.147s -user 0m0.103s -sys 0m0.045s - -=============================================================================== - -coverage annotate -The annotate command will be removed in a future version. -Get in touch if you still use it: ned@nedbatchelder.com - -real 0m0.127s -user 0m0.080s -sys 0m0.047s - -tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! ' - -> def count_words(sentence: str) -> Dict[str, int]: -> """Counts the number of times each word in a string is used. - -=============================================================================== - -Running: misspell ./__init__.py ./word_count.py ./word_count_test.py - -real 0m0.020s -user 0m0.026s -sys 0m0.005s - -=============================================================================== -