From 69f9b93c65ceb3dad4a1eae9791bc21b039db90c Mon Sep 17 00:00:00 2001 From: Victor Payno Date: Sat, 13 Apr 2024 08:49:26 -0700 Subject: [PATCH] python/roman-numerals: 3rd iteration - py3.11 --- python/roman-numerals/.coverage | 2 +- python/roman-numerals/.coverage.xml | 20 +- python/roman-numerals/roman_numerals.py | 6 + python/roman-numerals/roman_numerals.py,cover | 6 + python/roman-numerals/run-tests-python.txt | 206 +++++++++--------- 5 files changed, 125 insertions(+), 115 deletions(-) diff --git a/python/roman-numerals/.coverage b/python/roman-numerals/.coverage index 37ef0b9b..3feb50df 100644 --- a/python/roman-numerals/.coverage +++ b/python/roman-numerals/.coverage @@ -1 +1 @@ -!coverage.py: This is a private format, don't read it directly!{"arcs":{"/home/vpayno/git_vpayno/exercism-workspace/python/roman-numerals/test/__init__.py":[[0,0],[0,-1]],"/home/vpayno/git_vpayno/exercism-workspace/python/roman-numerals/roman_numerals.py":[[0,1],[1,3],[3,5],[5,6],[6,7],[7,10],[10,-1],[10,11],[11,13],[13,14],[14,15],[15,16],[16,17],[17,18],[18,19],[19,20],[20,21],[21,22],[22,23],[23,24],[24,25],[25,26],[26,28],[28,29],[29,30],[30,31],[31,29],[29,28],[28,33],[33,-10]]}} \ No newline at end of file +!coverage.py: This is a private format, don't read it directly!{"arcs":{"/home/vpayno/git_vpayno/exercism-workspace/python/roman-numerals/test/__init__.py":[[0,0],[0,-1]],"/home/vpayno/git_vpayno/exercism-workspace/python/roman-numerals/roman_numerals.py":[[0,1],[1,3],[3,5],[5,6],[6,7],[7,10],[10,-1],[10,17],[17,19],[19,20],[20,21],[21,22],[22,23],[23,24],[24,25],[25,26],[26,27],[27,28],[28,29],[29,30],[30,31],[31,32],[32,34],[34,35],[35,36],[36,37],[37,35],[35,34],[34,39],[39,-10]]}} \ No newline at end of file diff --git a/python/roman-numerals/.coverage.xml b/python/roman-numerals/.coverage.xml index 8bdf9170..50c6f742 100644 --- a/python/roman-numerals/.coverage.xml +++ b/python/roman-numerals/.coverage.xml @@ -1,5 +1,5 @@ - + @@ -17,13 +17,7 @@ - - - - - - @@ -32,11 +26,17 @@ - - + + + - + + + + + + diff --git a/python/roman-numerals/roman_numerals.py b/python/roman-numerals/roman_numerals.py index 87ee92ce..525c7ab6 100644 --- a/python/roman-numerals/roman_numerals.py +++ b/python/roman-numerals/roman_numerals.py @@ -8,6 +8,12 @@ def roman(number: ModernNumeralT) -> RomanNumeralT: + """Convert a decimal number to a roman numeral. + + :param number: integer + :return: string + """ + rn: RomanNumeralT = "" d2r: MapD2RT = OrderedDict() diff --git a/python/roman-numerals/roman_numerals.py,cover b/python/roman-numerals/roman_numerals.py,cover index 2e1da3d6..950b1b9c 100644 --- a/python/roman-numerals/roman_numerals.py,cover +++ b/python/roman-numerals/roman_numerals.py,cover @@ -8,6 +8,12 @@ > def roman(number: ModernNumeralT) -> RomanNumeralT: +> """Convert a decimal number to a roman numeral. + +> :param number: integer +> :return: string +> """ + > rn: RomanNumeralT = "" > d2r: MapD2RT = OrderedDict() diff --git a/python/roman-numerals/run-tests-python.txt b/python/roman-numerals/run-tests-python.txt index 003f6b9a..5b48cf23 100644 --- a/python/roman-numerals/run-tests-python.txt +++ b/python/roman-numerals/run-tests-python.txt @@ -23,38 +23,36 @@ pylint 3.0.3 astroid 3.0.2 Python 3.12.1 (main, Dec 28 2023, 08:22:05) [GCC 10.2.1 20210110] -real 0m0.234s -user 0m0.156s -sys 0m0.080s +real 0m0.220s +user 0m0.166s +sys 0m0.056s ============================================================================== Running: pylint ./src -************* Module roman_numerals.roman_numerals -src/roman_numerals/roman_numerals.py:10:0: C0116: Missing function or method docstring (missing-function-docstring) ------------------------------------------------------------------- -Your code has been rated at 9.60/10 (previous run: 9.60/10, +0.00) +------------------------------------------------------------------- +Your code has been rated at 10.00/10 (previous run: 9.60/10, +0.40) -real 0m0.558s -user 0m0.483s -sys 0m0.078s +real 0m0.556s +user 0m0.479s +sys 0m0.079s ============================================================================== -Exit code: -1 +Exit code: 0 -real 0m1.732s -user 0m1.304s -sys 0m0.454s +real 0m1.719s +user 0m1.310s +sys 0m0.432s -real 0m1.736s -user 0m1.307s -sys 0m0.455s +real 0m1.724s +user 0m1.313s +sys 0m0.433s =============================================================================== @@ -76,9 +74,9 @@ Running: ruff --version ruff 0.3.5 -real 0m0.077s -user 0m0.028s -sys 0m0.052s +real 0m0.083s +user 0m0.031s +sys 0m0.055s ============================================================================== @@ -87,22 +85,22 @@ Running: ruff check --ignore E501 ./src All checks passed! -real 0m0.114s -user 0m0.045s -sys 0m0.073s +real 0m0.125s +user 0m0.042s +sys 0m0.088s ============================================================================== Exit code: 0 -real 0m1.063s -user 0m0.700s -sys 0m0.387s +real 0m1.154s +user 0m0.742s +sys 0m0.438s -real 0m1.064s -user 0m0.700s -sys 0m0.389s +real 0m1.156s +user 0m0.743s +sys 0m0.439s =============================================================================== @@ -124,9 +122,9 @@ Running: pyright --version pyright 1.1.358 -real 0m0.690s -user 0m0.509s -sys 0m0.104s +real 0m0.780s +user 0m0.630s +sys 0m0.111s ============================================================================== @@ -136,7 +134,7 @@ Running: pyright --stats ./src Found 2 source files pyright 1.1.358 0 errors, 0 warnings, 0 informations -Completed in 0.589sec +Completed in 0.605sec Analysis stats Total files parsed and bound: 20 @@ -144,30 +142,30 @@ Total files checked: 2 Timing stats Find Source Files: 0sec -Read Source Files: 0.01sec +Read Source Files: 0sec Tokenize: 0.04sec -Parse: 0.04sec -Resolve Imports: 0.06sec -Bind: 0.05sec -Check: 0.08sec +Parse: 0.06sec +Resolve Imports: 0.05sec +Bind: 0.04sec +Check: 0.09sec Detect Cycles: 0sec -real 0m1.197s -user 0m1.195s -sys 0m0.178s +real 0m1.245s +user 0m1.325s +sys 0m0.197s ============================================================================== Exit code: 0 -real 0m2.802s -user 0m2.341s -sys 0m0.578s +real 0m2.952s +user 0m2.606s +sys 0m0.601s -real 0m2.805s -user 0m2.343s -sys 0m0.579s +real 0m2.955s +user 0m2.609s +sys 0m0.602s =============================================================================== @@ -190,9 +188,9 @@ Running: bandit --version bandit 1.7.7 python version = 3.12.1 (main, Dec 28 2023, 08:22:05) [GCC 10.2.1 20210110] -real 0m0.288s -user 0m0.217s -sys 0m0.074s +real 0m0.400s +user 0m0.330s +sys 0m0.069s ============================================================================== @@ -204,7 +202,7 @@ Running: bandit --verbose --recursive ./src [main] INFO cli include tests: None [main] INFO cli exclude tests: None [main] INFO running on Python 3.12.1 -Run started:2024-04-13 15:45:52.589695 +Run started:2024-04-13 15:48:58.005343 Files in scope (2): ./src/roman_numerals/__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0}) ./src/roman_numerals/roman_numerals.py (score: {SEVERITY: 0, CONFIDENCE: 0}) @@ -216,7 +214,7 @@ Test results: No issues identified. Code scanned: - Total lines of code: 26 + Total lines of code: 30 Total lines skipped (#nosec): 0 Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0 @@ -233,22 +231,22 @@ Run metrics: High: 0 Files skipped (0): -real 0m0.212s -user 0m0.151s -sys 0m0.062s +real 0m0.314s +user 0m0.233s +sys 0m0.085s ============================================================================== Exit code: 0 -real 0m1.391s -user 0m1.004s -sys 0m0.406s +real 0m1.665s +user 0m1.245s +sys 0m0.441s -real 0m1.394s -user 0m1.006s -sys 0m0.406s +real 0m1.667s +user 0m1.245s +sys 0m0.443s =============================================================================== @@ -271,9 +269,9 @@ Running: refurb --version Refurb: v1.26.0 Mypy: v1.9.0 -real 0m0.205s -user 0m0.131s -sys 0m0.077s +real 0m0.214s +user 0m0.136s +sys 0m0.081s ============================================================================== @@ -281,22 +279,22 @@ sys 0m0.077s Running: refurb --quiet --ignore 183 ./src -real 0m1.065s -user 0m0.970s -sys 0m0.097s +real 0m1.117s +user 0m1.030s +sys 0m0.090s ============================================================================== Exit code: 0 -real 0m3.255s -user 0m2.727s -sys 0m0.552s +real 0m3.686s +user 0m3.130s +sys 0m0.581s -real 0m3.258s -user 0m2.728s -sys 0m0.553s +real 0m3.690s +user 0m3.132s +sys 0m0.583s =============================================================================== @@ -332,22 +330,22 @@ Test passed. 0 passed and 0 failed. Test passed. -real 0m0.137s -user 0m0.077s -sys 0m0.062s +real 0m0.123s +user 0m0.079s +sys 0m0.047s ============================================================================== Exit code: 0 -real 0m1.060s -user 0m0.707s -sys 0m0.375s +real 0m0.999s +user 0m0.694s +sys 0m0.323s -real 0m1.062s -user 0m0.709s -sys 0m0.375s +real 0m1.001s +user 0m0.694s +sys 0m0.325s =============================================================================== @@ -379,9 +377,9 @@ Running: pytest --version pytest 7.4.3 -real 0m0.795s -user 0m0.793s -sys 0m0.855s +real 0m0.785s +user 0m0.856s +sys 0m0.819s ============================================================================== @@ -444,11 +442,11 @@ test/__init__.py 0 0 0 0 100% TOTAL 26 1 4 0 97% Coverage XML written to file .coverage.xml -======================== 26 passed, 1 warning in 1.00s ========================= +======================== 26 passed, 1 warning in 0.99s ========================= -real 0m1.859s -user 0m1.717s -sys 0m0.144s +real 0m1.878s +user 0m1.741s +sys 0m0.139s ============================================================================== @@ -462,9 +460,9 @@ test/__init__.py 0 0 0 0 100% --------------------------------------------------------------- TOTAL 26 1 4 0 97% -real 0m0.127s -user 0m0.084s -sys 0m0.044s +real 0m0.146s +user 0m0.093s +sys 0m0.055s ============================================================================== @@ -472,9 +470,9 @@ sys 0m0.044s Running: coverage annotate -real 0m0.151s +real 0m0.147s user 0m0.090s -sys 0m0.064s +sys 0m0.059s ============================================================================== @@ -486,28 +484,28 @@ Branch Coverage: 100.0% Exit code: 0 -real 0m3.844s -user 0m3.310s -sys 0m1.408s +real 0m3.937s +user 0m3.453s +sys 0m1.399s -real 0m3.846s -user 0m3.310s -sys 0m1.410s +real 0m3.939s +user 0m3.453s +sys 0m1.401s =============================================================================== tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! ' > def roman(number: ModernNumeralT) -> RomanNumeralT: -> rn: RomanNumeralT = "" +> """Convert a decimal number to a roman numeral. =============================================================================== Running: misspell ./src/roman_numerals/__init__.py ./src/roman_numerals/roman_numerals.py -real 0m0.025s -user 0m0.030s -sys 0m0.009s +real 0m0.019s +user 0m0.018s +sys 0m0.010s ===============================================================================