From a4ddc99a94f8ffcf27b85b42e3eeb53000891c1e Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sun, 21 Apr 2024 23:26:31 +0530 Subject: [PATCH 1/5] spiral-matrix solved by simple while loop --- .../__pycache__/spiral_matrix.cpython-38.pyc | Bin 0 -> 802 bytes ...al_matrix_test.cpython-38-pytest-6.2.4.pyc | Bin 0 -> 1962 bytes practice/spiral-matrix/spiral_matrix.py | 46 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc create mode 100644 practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc diff --git a/practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc b/practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3170646052b9bc61c87e7c1741313289c9197f48 GIT binary patch literal 802 zcmZWnzi-n}5WaiQKhmi2097d?14AT;nV>@yfs}!%167wuRb>3!)QS@)@42E>&kLzU zM))(j^VfJqLdwhp3*5zxNa;y;@9y4r_npu0q}6HyiF^F??3WAhor7%=6uc%iyJQq7 zyoLcNaSUx4Bc(RdAjcttj>04pZ%Ew^+E?A-DD=5YMot0}(5?)&89^NOsw}t=2 zJrAMu2=7^!XHo7#ZZSCjF?{2$RN+vC!)*5|n8V%T_`!W?I(PokB5lh%y0b1`E3fMz zuWO&o2rQfiv>+HEFW{?~J5+`%x`P{Ni%N7}R5-lB$}#CxqPfHGx8aFNvL`0Yi3*)w-bTYZ>dZb?&2E;OBF-nX9(Oi8 zoJYUt>PcO=fp)Vzjxy8h{KK#K9cVVIKO}9eTpdkENxPvvN)Ei5rIOQ&$zVt4ABLug zbTRPRO{QwF6X)3`$1de6OxIti=}m(6$yBX7gD{$C39A6t8Cl16uutBWk@asQvB@E1?QumAu6 literal 0 HcmV?d00001 diff --git a/practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc b/practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb04689f48836c15a8fa95ccbe6e04827728ee17 GIT binary patch literal 1962 zcmb7FTTc@~6rR~jyDcqpSMVBRj2NYf=$kPZH9papfG>TSl%8c>X`#+63dA?~AL=82 zX`H_kCw(_HDgh75qG3nA`jk2=N`k@WXXtg+KF>4GEH6 z(UPw8dcG&5=mo7%7A>V#iCesGxmRwLrFbpKr{G9X5SQLZhkmOa{bS?sZT-{CFI!@MoT~iQTd-k0g0VqU9G;w*m^O#BoSvinuIMg{oYZX^d)I zMpWk|$McCbx74azX+1VsNAjen4}1`P!JnC7^I3cqnIw5A6Y?gnFmZSDSm=nuAFGYG+`%-SZ@f#*yLhYdGB#V;PQMZF#k!N4UZbzu zoh_1mruKuIC~#c&SL>>f*Veu-T6DTvjaxJVI`M}TkH&h&}) z*MuX7(|C?t!1NqBP-BnJAkH6qbsDEjG?4^JFd#eGbe#T>b=+-@=e3SI80%StE~nT~ z*2#mTX#qq}!A!y+aTnC%@jQ<)P*})7mgN0k2mhDy$0Mo$v{U5`J0q%utP7{SNH|s5 zXH^PK*q@+Dnxbi%VSkq9=rUcQ`6Nujfl>=iC&M|V3iYn?f))x`XkncU&_`cGh+}O* z)4Dp>>cY#Y!+x+3xR4N?H5&8+%yk$i@Wr;-lbbxyV4#!LtI3o1r}w`CKWQ#j@<^%e zb}v>cuPW8sq1`V0no_uKix%xR0mRqX9U6r64VZf{NbQhu#|W1K1{jz~M*hiL(r8(% z=F!G(+Rf5!lh;=I`)Ux)tNuQ&jHTkzPj|MLbo@!DS)5k}ReAZeuF8Ym4b#?nw7Z>V n2;5I1kJj0J(dIt`mK*};@VW~%dRh>EhGXuwXe6dY + +# A while loop is used to fill the matrix in a spiral order. +# The loop continues until num is greater than the total number of elements in the matrix (size * size) + +# Inside the loop, four for loops are used to fill +# the top row from left to right, +# the right column from top to bottom, +# the bottom row from right to left, +# and the left column from bottom to top, respectively. +# After each for loop, the corresponding starting or ending index is updated to move towards the center of the matrix. + +# After the while loop, the filled matrix is returned. \ No newline at end of file From b7893eebe4068fa659b995f34057171414c77534 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 22 Apr 2024 02:16:28 +0530 Subject: [PATCH 2/5] run only impacted tests --- .github/workflows/python-app.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 48d1bde..3547873 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -30,7 +30,8 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - pytest --continue-on-collection-errors + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From 861f276693a6b9499475497f026c45727fe2c630 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 22 Apr 2024 02:19:03 +0530 Subject: [PATCH 3/5] run only impacted tests --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3547873..a4e04c8 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -31,7 +31,7 @@ jobs: - name: Test with pytest run: | git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs + git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs pytest - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From 1856c1924b436e5762fb0e0e448b3ae7ce910a81 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 22 Apr 2024 02:40:16 +0530 Subject: [PATCH 4/5] resolved conflicts --- .github/workflows/python-app.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index a4e04c8..e1ba390 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -30,11 +30,11 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs pytest + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs pytest - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics \ No newline at end of file From 0f9b128ffd8990689e63e820ed316e3f10553633 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 22 Apr 2024 03:05:00 +0530 Subject: [PATCH 5/5] removed pycache to rectify build issues --- .../__pycache__/spiral_matrix.cpython-38.pyc | Bin 802 -> 0 bytes ...piral_matrix_test.cpython-38-pytest-6.2.4.pyc | Bin 1962 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc delete mode 100644 practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc diff --git a/practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc b/practice/spiral-matrix/__pycache__/spiral_matrix.cpython-38.pyc deleted file mode 100644 index 3170646052b9bc61c87e7c1741313289c9197f48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 802 zcmZWnzi-n}5WaiQKhmi2097d?14AT;nV>@yfs}!%167wuRb>3!)QS@)@42E>&kLzU zM))(j^VfJqLdwhp3*5zxNa;y;@9y4r_npu0q}6HyiF^F??3WAhor7%=6uc%iyJQq7 zyoLcNaSUx4Bc(RdAjcttj>04pZ%Ew^+E?A-DD=5YMot0}(5?)&89^NOsw}t=2 zJrAMu2=7^!XHo7#ZZSCjF?{2$RN+vC!)*5|n8V%T_`!W?I(PokB5lh%y0b1`E3fMz zuWO&o2rQfiv>+HEFW{?~J5+`%x`P{Ni%N7}R5-lB$}#CxqPfHGx8aFNvL`0Yi3*)w-bTYZ>dZb?&2E;OBF-nX9(Oi8 zoJYUt>PcO=fp)Vzjxy8h{KK#K9cVVIKO}9eTpdkENxPvvN)Ei5rIOQ&$zVt4ABLug zbTRPRO{QwF6X)3`$1de6OxIti=}m(6$yBX7gD{$C39A6t8Cl16uutBWk@asQvB@E1?QumAu6 diff --git a/practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc b/practice/spiral-matrix/__pycache__/spiral_matrix_test.cpython-38-pytest-6.2.4.pyc deleted file mode 100644 index cb04689f48836c15a8fa95ccbe6e04827728ee17..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1962 zcmb7FTTc@~6rR~jyDcqpSMVBRj2NYf=$kPZH9papfG>TSl%8c>X`#+63dA?~AL=82 zX`H_kCw(_HDgh75qG3nA`jk2=N`k@WXXtg+KF>4GEH6 z(UPw8dcG&5=mo7%7A>V#iCesGxmRwLrFbpKr{G9X5SQLZhkmOa{bS?sZT-{CFI!@MoT~iQTd-k0g0VqU9G;w*m^O#BoSvinuIMg{oYZX^d)I zMpWk|$McCbx74azX+1VsNAjen4}1`P!JnC7^I3cqnIw5A6Y?gnFmZSDSm=nuAFGYG+`%-SZ@f#*yLhYdGB#V;PQMZF#k!N4UZbzu zoh_1mruKuIC~#c&SL>>f*Veu-T6DTvjaxJVI`M}TkH&h&}) z*MuX7(|C?t!1NqBP-BnJAkH6qbsDEjG?4^JFd#eGbe#T>b=+-@=e3SI80%StE~nT~ z*2#mTX#qq}!A!y+aTnC%@jQ<)P*})7mgN0k2mhDy$0Mo$v{U5`J0q%utP7{SNH|s5 zXH^PK*q@+Dnxbi%VSkq9=rUcQ`6Nujfl>=iC&M|V3iYn?f))x`XkncU&_`cGh+}O* z)4Dp>>cY#Y!+x+3xR4N?H5&8+%yk$i@Wr;-lbbxyV4#!LtI3o1r}w`CKWQ#j@<^%e zb}v>cuPW8sq1`V0no_uKix%xR0mRqX9U6r64VZf{NbQhu#|W1K1{jz~M*hiL(r8(% z=F!G(+Rf5!lh;=I`)Ux)tNuQ&jHTkzPj|MLbo@!DS)5k}ReAZeuF8Ym4b#?nw7Z>V n2;5I1kJj0J(dIt`mK*};@VW~%dRh>EhGXuwXe6dY