Open sweep-mine[bot] opened 11 months ago
cli_snake_game/snake.py
β
Sandbox logs for https://github.com/eranheres/cli_snake_game_self/commit/011eab12a80d79c9cb6752007db67cdf20c60d1e
trunk fmt cli_snake_game/snake.py || return 0
1/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
2/19 βISSUES cli_snake_game/snake.py:7:30 7:30 high Do not use mutable data structures for argument defaults ruff/B006 43:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 Checked 1 file 2 existing issues (1 auto-fixable)
pytest
3/19 β============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 4 items tests/test_empty.py . [ 25%] tests/test_food.py ... [100%] ============================== 4 passed in 0.04s ===============================
trunk fmt cli_snake_game/snake.py || return 0
4/19 β (`2`)β Formatted cli_snake_game/snake.py Re-checking autofixed files... FAILURES black cli_snake_game/snake.py .trunk/out/xiUl4.yaml black cli_snake_game/snake.py .trunk/out/LrAQV.yaml NOTICES Some tools failed to run. You can open the details yaml files for more information. Checked 1 file β No issues, 2 failures bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0
5/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
6/19 β (`1`)β Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... ISSUES cli_snake_game/snake.py:75:7 9:30 high Do not use mutable data structures for argument defaults ruff/B006 47:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 75:7 high Redefinition of unused `Food` from line 42 ruff/F811 80:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 Checked 1 file 2 existing issues (1 auto-fixable) β 2 new issues
trunk fmt cli_snake_game/snake.py || return 0
7/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
8/19 β (`1`)β Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... ISSUES cli_snake_game/snake.py:73:7 45:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 73:7 high Redefinition of unused `Food` from line 40 ruff/F811 78:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 Checked 1 file 1 existing issue β 2 new issues
trunk fmt cli_snake_game/snake.py || return 0
9/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
10/19 β (`1`)β Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... ISSUES cli_snake_game/snake.py:73:7 45:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 73:7 high Redefinition of unused `Food` from line 40 ruff/F811 78:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 Checked 1 file 1 existing issue β 2 new issues
trunk fmt cli_snake_game/snake.py || return 0
11/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
12/19 β (`1`)β Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... ISSUES cli_snake_game/snake.py:47:26 47:26 high Undefined name `secrets` ruff/F821 47:54 high Undefined name `secrets` ruff/F821 75:7 high Redefinition of unused `Food` from line 40 ruff/F811 80:0 low Standard pseudo-random generators are not suitable for security/cryptographic purposes. bandit/B311 Checked 1 file 1 existing issue β 3 new issues
trunk fmt cli_snake_game/snake.py || return 0
13/19 β (`2`)β Formatted cli_snake_game/snake.py Re-checking autofixed files... FAILURES black cli_snake_game/snake.py .trunk/out/8bofd.yaml black cli_snake_game/snake.py .trunk/out/FgXPN.yaml NOTICES Some tools failed to run. You can open the details yaml files for more information. Checked 1 file β No issues, 2 failures bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0
14/19 β (`2`)β Formatted cli_snake_game/snake.py Re-checking autofixed files... FAILURES black cli_snake_game/snake.py .trunk/out/tembR.yaml black cli_snake_game/snake.py .trunk/out/ycdaj.yaml NOTICES Some tools failed to run. You can open the details yaml files for more information. Checked 1 file β No issues, 2 failures bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0
15/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
16/19 β (`1`)β Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... ISSUES cli_snake_game/snake.py:49:7 49:7 high Redefinition of unused `Food` from line 40 ruff/F811 Checked 1 file β 1 new issue
trunk fmt cli_snake_game/snake.py || return 0
17/19 ββ Formatted cli_snake_game/snake.py Re-checking autofixed files... β Formatted cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures cli_snake_game/snake.py
18/19 ββ Auto-fixed cli_snake_game/snake.py Re-checking autofixed files... Checked 1 file β No issues
pytest
19/19 β============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 4 items tests/test_empty.py . [ 25%] tests/test_food.py ... [100%] ============================== 4 passed in 0.03s ===============================
requirements.txt
β
Sandbox logs for
trunk fmt requirements.txt || return 0
1/6 βFound no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt
2/6 βChecked 1 file β No issues
pytest
3/6 β============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 4 items tests/test_empty.py . [ 25%] tests/test_food.py ... [100%] ============================== 4 passed in 0.05s ===============================
trunk fmt requirements.txt || return 0
4/6 βFound no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt
5/6 βChecked 1 file β No issues
pytest
6/6 β============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 4 items tests/test_empty.py . [ 25%] tests/test_food.py ... [100%] ============================== 4 passed in 0.04s ===============================
Description
This PR adds support for changing the color of the snake's head to light green in the command-line snake game. It introduces the
colorama
library to enable colored console output and modifies theSnake
class to incorporate the new color attribute.Summary
colorama
library to enable colored console output.self.color
to theSnake
class and set it toFore.LIGHTGREEN_EX
fromcolorama
.move
method to change the console output color to the snake's color before updating the snake's position and reset it to the default color afterward.requirements.txt
file to includecolorama
as a project dependency.Fixes #32.
π Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py
!π‘ To get Sweep to edit this pull request, you can: