From c757a5fee0c217cd47cea9e881a1272ad2f57bcd Mon Sep 17 00:00:00 2001 From: Victor Payno Date: Thu, 4 Apr 2024 20:41:51 -0700 Subject: [PATCH] python/plane-tickets: 3rd iteration - py3.11 - pylint fix --- python/plane-tickets/.coverage | Bin 53247 -> 53247 bytes python/plane-tickets/.coverage.xml | 22 +-- python/plane-tickets/generators.py | 5 +- python/plane-tickets/generators.py,cover | 5 +- python/plane-tickets/run-tests-python.txt | 218 +++++++++++----------- 5 files changed, 120 insertions(+), 130 deletions(-) diff --git a/python/plane-tickets/.coverage b/python/plane-tickets/.coverage index e3ac405cfdb598035cd4f30f8b90f5df744ea808..824ef023d4e30c4678c7dfa0d6c0671992c77b72 100644 GIT binary patch delta 651 zcmXxgJ4gZn7{KvF@=NNzl!mf=zw`Zq207*Az@bGs6HbSQ6QQ{|92=VA#)e$NF~RAU z8d_Q!C1`7I4g!Zuzx!_c@gM)@qtkqJ&Ye?d4GX$!dbRL+UW5tMw%u-rW2`}ypv|B{ z7>%K9l@XK(GYyIa)r10Js6yTW2AZ3*vOp>Io0trH= z3vq(cff%8!LX^;wAwrNv2ot0hgb3mif>x0sKxjzdCp0BEu}Tw;31S0$gt`bv9@4T7 zhlFffuRp)<)P&U*#_&Pkoma~rXyPw^;}5>!CqAQrPk4{Fc!O7XjhC3m3zYC2&u|-k zxG${MWAB8C+qL<+9$RB+vnp#euGno3=W6p4d3% RS{HTi>w%-aNW6Y|{sH!eU|j$J delta 684 zcmXxgKS%;$7{~F%>`CgLiiXmxG_x}EPnk9-C(6lzjoOKD+IDiYb2v7~jSV^&v?&Ne zOARe8jS{pqMKm=uHC+1KbK8gS3lF?Mv*R>7&VjS*Ory`3>*})@Lf>#@`Ce#4+U0gT z9J&T6g4TmmLQ{vNRhn=@=xK0FP)$e>8Y;xC(tsGDu0qr*bvPo_Mi3z=H8>OZXE$Cv&%iwtH^6_GIofOY5arP5snv%_OU*ov>8% znAK1dc5B30bv0(UdX!Zg9kG;Jgw?Jphjy%nSrz4gRj%x_M&&(LNe!`NahFw;gDk1I sV@nRO@{*rbkhbks*qX{U`MWqaz8-yxS<%aHnXIw$wCX4gLr?F^|86j4%K!iX diff --git a/python/plane-tickets/.coverage.xml b/python/plane-tickets/.coverage.xml index 3f2f5f39..b4c28f03 100644 --- a/python/plane-tickets/.coverage.xml +++ b/python/plane-tickets/.coverage.xml @@ -1,5 +1,5 @@ - + @@ -31,24 +31,22 @@ - + - - + - - + + + - - + - - - - + + + diff --git a/python/plane-tickets/generators.py b/python/plane-tickets/generators.py index 29e46ac5..aea5e48e 100644 --- a/python/plane-tickets/generators.py +++ b/python/plane-tickets/generators.py @@ -56,12 +56,9 @@ def generate_seats(quantity: QuantityT) -> Generator[SeatT, Any, Any]: Example: 3C, 3D, 4A, 4B """ - letter: Generator[LetterT, Any, Any] = generate_seat_letters(quantity) row: RowT = 0 - for _ in range(1, quantity + 1): - seat: SeatT = next(letter) - + for seat in generate_seat_letters(quantity): if seat == "A": row += 1 diff --git a/python/plane-tickets/generators.py,cover b/python/plane-tickets/generators.py,cover index bbaecc30..3cc7f56c 100644 --- a/python/plane-tickets/generators.py,cover +++ b/python/plane-tickets/generators.py,cover @@ -56,12 +56,9 @@ > Example: 3C, 3D, 4A, 4B > """ -> letter: Generator[LetterT, Any, Any] = generate_seat_letters(quantity) > row: RowT = 0 -> for _ in range(1, quantity + 1): -> seat: SeatT = next(letter) - +> for seat in generate_seat_letters(quantity): > if seat == "A": > row += 1 diff --git a/python/plane-tickets/run-tests-python.txt b/python/plane-tickets/run-tests-python.txt index cf27e604..96f7eb91 100644 --- a/python/plane-tickets/run-tests-python.txt +++ b/python/plane-tickets/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.241s -user 0m0.193s -sys 0m0.050s +real 0m0.238s +user 0m0.158s +sys 0m0.082s ============================================================================== Running: pylint ./src -************* Module plane_tickets.generators -src/plane_tickets/generators.py:63:22: R1708: Do not raise StopIteration in generator, use return statement instead (stop-iteration-return) ------------------------------------------------------------------- -Your code has been rated at 9.74/10 (previous run: 9.74/10, +0.00) +------------------------------------------------------------------- +Your code has been rated at 10.00/10 (previous run: 9.74/10, +0.26) -real 0m0.892s -user 0m0.833s -sys 0m0.061s +real 0m0.768s +user 0m0.685s +sys 0m0.084s ============================================================================== -Exit code: -1 +Exit code: 0 -real 0m2.286s -user 0m1.839s -sys 0m0.469s +real 0m1.992s +user 0m1.511s +sys 0m0.501s -real 0m2.292s -user 0m1.843s -sys 0m0.472s +real 0m1.997s +user 0m1.512s +sys 0m0.505s =============================================================================== @@ -76,9 +74,9 @@ Running: ruff --version ruff 0.3.5 -real 0m0.071s -user 0m0.029s -sys 0m0.043s +real 0m0.070s +user 0m0.032s +sys 0m0.039s ============================================================================== @@ -87,22 +85,22 @@ Running: ruff check --ignore E501 ./src All checks passed! -real 0m0.068s -user 0m0.025s -sys 0m0.046s +real 0m0.126s +user 0m0.055s +sys 0m0.074s ============================================================================== Exit code: 0 -real 0m1.185s -user 0m0.858s -sys 0m0.343s +real 0m1.149s +user 0m0.754s +sys 0m0.415s -real 0m1.187s -user 0m0.859s -sys 0m0.344s +real 0m1.151s +user 0m0.756s +sys 0m0.415s =============================================================================== @@ -124,9 +122,9 @@ Running: pyright --version pyright 1.1.357 -real 0m0.778s -user 0m0.639s -sys 0m0.130s +real 0m0.676s +user 0m0.500s +sys 0m0.128s ============================================================================== @@ -136,7 +134,7 @@ Running: pyright --stats ./src Found 2 source files pyright 1.1.357 0 errors, 0 warnings, 0 informations -Completed in 0.653sec +Completed in 0.601sec 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 -Tokenize: 0.05sec +Read Source Files: 0sec +Tokenize: 0.06sec Parse: 0.05sec -Resolve Imports: 0.06sec -Bind: 0.05sec -Check: 0.08sec +Resolve Imports: 0.05sec +Bind: 0.06sec +Check: 0.06sec Detect Cycles: 0sec -real 0m1.357s -user 0m1.366s -sys 0m0.186s +real 0m1.269s +user 0m1.421s +sys 0m0.188s ============================================================================== Exit code: 0 -real 0m3.313s -user 0m2.927s -sys 0m0.587s +real 0m2.930s +user 0m2.579s +sys 0m0.658s -real 0m3.315s -user 0m2.928s -sys 0m0.588s +real 0m2.933s +user 0m2.581s +sys 0m0.659s =============================================================================== @@ -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.305s -user 0m0.250s -sys 0m0.057s +real 0m0.285s +user 0m0.220s +sys 0m0.067s ============================================================================== @@ -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-05 03:25:06.323258 +Run started:2024-04-05 03:39:46.246487 Files in scope (2): ./src/plane_tickets/__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0}) ./src/plane_tickets/generators.py (score: {SEVERITY: 0, CONFIDENCE: 0}) @@ -216,7 +214,7 @@ Test results: No issues identified. Code scanned: - Total lines of code: 67 + Total lines of code: 65 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.267s -user 0m0.195s -sys 0m0.074s +real 0m0.237s +user 0m0.166s +sys 0m0.071s ============================================================================== Exit code: 0 -real 0m1.572s -user 0m1.210s -sys 0m0.377s +real 0m1.526s +user 0m1.063s +sys 0m0.482s -real 0m1.575s -user 0m1.212s -sys 0m0.378s +real 0m1.529s +user 0m1.064s +sys 0m0.484s =============================================================================== @@ -271,9 +269,9 @@ Running: refurb --version Refurb: v1.26.0 Mypy: v1.9.0 -real 0m0.253s -user 0m0.181s -sys 0m0.074s +real 0m0.200s +user 0m0.143s +sys 0m0.058s ============================================================================== @@ -281,22 +279,22 @@ sys 0m0.074s Running: refurb ./src -real 0m1.337s -user 0m1.253s -sys 0m0.086s +real 0m1.110s +user 0m1.029s +sys 0m0.082s ============================================================================== Exit code: 0 -real 0m2.585s -user 0m2.186s -sys 0m0.414s +real 0m2.249s +user 0m1.830s +sys 0m0.434s -real 0m2.587s -user 0m2.187s -sys 0m0.415s +real 0m2.252s +user 0m1.830s +sys 0m0.436s =============================================================================== @@ -335,22 +333,22 @@ Test passed. 0 passed and 0 failed. Test passed. -real 0m0.155s -user 0m0.083s -sys 0m0.075s +real 0m0.146s +user 0m0.087s +sys 0m0.061s ============================================================================== Exit code: 0 -real 0m1.104s -user 0m0.807s -sys 0m0.313s +real 0m1.088s +user 0m0.759s +sys 0m0.344s -real 0m1.106s -user 0m0.807s -sys 0m0.315s +real 0m1.090s +user 0m0.759s +sys 0m0.347s =============================================================================== @@ -372,8 +370,8 @@ Running: rm -rf ./coverage real 0m0.001s -user 0m0.001s -sys 0m0.000s +user 0m0.000s +sys 0m0.001s ============================================================================== @@ -382,9 +380,9 @@ Running: pytest --version pytest 7.4.3 -real 0m0.844s -user 0m0.909s -sys 0m0.826s +real 0m0.862s +user 0m0.914s +sys 0m0.836s ============================================================================== @@ -416,17 +414,17 @@ test/generators_test.py::PlaneTicketsTest::test_task4_returns_generator PASSED [ ---------- coverage: platform linux, python 3.12.1-final-0 ----------- Name Stmts Miss Branch BrPart Cover Missing ----------------------------------------------------------- -generators.py 38 0 12 0 100% +generators.py 36 0 12 0 100% ----------------------------------------------------------- -TOTAL 38 0 12 0 100% +TOTAL 36 0 12 0 100% Coverage XML written to file .coverage.xml -============================== 8 passed in 0.39s =============================== +============================== 8 passed in 0.37s =============================== -real 0m1.244s -user 0m1.100s -sys 0m0.146s +real 0m1.209s +user 0m1.049s +sys 0m0.161s ============================================================================== @@ -435,13 +433,13 @@ Running: coverage report --show-missing Name Stmts Miss Branch BrPart Cover Missing ----------------------------------------------------------- -generators.py 38 0 12 0 100% +generators.py 36 0 12 0 100% ----------------------------------------------------------- -TOTAL 38 0 12 0 100% +TOTAL 36 0 12 0 100% -real 0m0.169s -user 0m0.107s -sys 0m0.063s +real 0m0.172s +user 0m0.105s +sys 0m0.069s ============================================================================== @@ -449,9 +447,9 @@ sys 0m0.063s Running: coverage annotate -real 0m0.173s -user 0m0.119s -sys 0m0.055s +real 0m0.162s +user 0m0.102s +sys 0m0.061s ============================================================================== @@ -463,13 +461,13 @@ Branch Coverage: 100.0% Exit code: 0 -real 0m3.448s -user 0m2.940s -sys 0m1.415s +real 0m3.377s +user 0m2.849s +sys 0m1.437s -real 0m3.451s -user 0m2.942s -sys 0m1.415s +real 0m3.379s +user 0m2.850s +sys 0m1.437s =============================================================================== @@ -494,9 +492,9 @@ tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! ' Running: misspell ./src/plane_tickets/generators.py ./src/plane_tickets/__init__.py -real 0m0.021s -user 0m0.018s -sys 0m0.014s +real 0m0.020s +user 0m0.021s +sys 0m0.008s ===============================================================================