eranheres / ultra_type

0 stars 0 forks source link

Sweep: Add docstrings to controller.py #37

Open eranheres opened 11 months ago

eranheres commented 11 months ago
Checklist - [X] Modify `ultra_type/controller.py` ✓ https://github.com/eranheres/ultra_type/commit/ecde46f4a945fc4c76f9e0144b5605c31b2a7278 - [X] Ran sandbox for `ultra_type/controller.py`. ✗ - [X] Modify `ultra_type/controller.py` ✓ https://github.com/eranheres/ultra_type/commit/18d0dc946359c646dae4efa189547dd3a814e9fd - [X] Ran sandbox for `ultra_type/controller.py`. ✗ - [X] Modify `ultra_type/controller.py` ✓ https://github.com/eranheres/ultra_type/commit/74778c0a9f0fefb0eb35cc509bd05ed595125dcc - [X] Ran sandbox for `ultra_type/controller.py`. ✗ - [ ] Modify `ultra_type/controller.py` ⋯ - [ ] Ran sandbox for `ultra_type/controller.py`. ▶ - [ ] Ran sandbox for `ultra_type/controller.py`. ▶ - [ ] Ran sandbox for `ultra_type/controller.py`. ▶ ![Flowchart](https://raw.githubusercontent.com/eranheres/ultra_type/sweep/assets/2f6bd0fbf8e5411e1945890b9690d7846cc066a803ae920fab9add613da9412c_37_flowchart.svg)
sweep-mine[bot] commented 11 months ago
Sweeping

50%
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: d21f59dae1)

![Docker Version Updated](https://img.shields.io/badge/Docker%20Version%20Updated-1%20hours%20ago-blue)

Actions (click)

Sandbox Execution ✓

Here are the sandbox execution logs prior to making any changes:

Sandbox logs for 7143879
pip install poetry 1/4 ✓
Requirement already satisfied: poetry in /usr/local/lib/python3.10/dist-packages (1.7.1)
Requirement already satisfied: requests<3.0,>=2.26 in /usr/local/lib/python3.10/dist-packages (from poetry) (2.31.0)
Requirement already satisfied: pexpect<5.0.0,>=4.7.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (4.8.0)
Requirement already satisfied: trove-classifiers>=2022.5.19 in /usr/local/lib/python3.10/dist-packages (from poetry) (2023.11.14)
Requirement already satisfied: fastjsonschema<3.0.0,>=2.18.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (2.19.0)
Requirement already satisfied: build<2.0.0,>=1.0.3 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.0.3)
Requirement already satisfied: dulwich<0.22.0,>=0.21.2 in /usr/local/lib/python3.10/dist-packages (from poetry) (0.21.6)
Requirement already satisfied: packaging>=20.5 in /usr/local/lib/python3.10/dist-packages (from poetry) (23.2)
Requirement already satisfied: shellingham<2.0,>=1.5 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.5.4)
Requirement already satisfied: crashtest<0.5.0,>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from poetry) (0.4.1)
Requirement already satisfied: keyring<25.0.0,>=24.0.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (24.3.0)
Requirement already satisfied: cachecontrol[filecache]<0.14.0,>=0.13.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (0.13.1)
Requirement already satisfied: poetry-plugin-export<2.0.0,>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.6.0)
Requirement already satisfied: platformdirs<4.0.0,>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (3.11.0)
Requirement already satisfied: poetry-core==1.8.1 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.8.1)
Requirement already satisfied: installer<0.8.0,>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (0.7.0)
Requirement already satisfied: virtualenv<21.0.0,>=20.23.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (20.24.7)
Requirement already satisfied: pkginfo<2.0.0,>=1.9.4 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.9.6)
Requirement already satisfied: tomli<3.0.0,>=2.0.1 in /usr/local/lib/python3.10/dist-packages (from poetry) (2.0.1)
Requirement already satisfied: pyproject-hooks<2.0.0,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.0.0)
Requirement already satisfied: cleo<3.0.0,>=2.1.0 in /usr/local/lib/python3.10/dist-packages (from poetry) (2.1.0)
Requirement already satisfied: requests-toolbelt<2,>=0.9.1 in /usr/local/lib/python3.10/dist-packages (from poetry) (1.0.0)
Requirement already satisfied: tomlkit<1.0.0,>=0.11.4 in /usr/local/lib/python3.10/dist-packages (from poetry) (0.12.3)
Requirement already satisfied: msgpack>=0.5.2 in /usr/local/lib/python3.10/dist-packages (from cachecontrol[filecache]<0.14.0,>=0.13.0->poetry) (1.0.7)
Requirement already satisfied: filelock>=3.8.0 in /usr/local/lib/python3.10/dist-packages (from cachecontrol[filecache]<0.14.0,>=0.13.0->poetry) (3.13.1)
Requirement already satisfied: rapidfuzz<4.0.0,>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from cleo<3.0.0,>=2.1.0->poetry) (3.5.2)
Requirement already satisfied: urllib3>=1.25 in /usr/local/lib/python3.10/dist-packages (from dulwich<0.22.0,>=0.21.2->poetry) (2.1.0)
Requirement already satisfied: importlib-metadata>=4.11.4 in /usr/local/lib/python3.10/dist-packages (from keyring<25.0.0,>=24.0.0->poetry) (6.8.0)
Requirement already satisfied: jaraco.classes in /usr/local/lib/python3.10/dist-packages (from keyring<25.0.0,>=24.0.0->poetry) (3.3.0)
Requirement already satisfied: jeepney>=0.4.2 in /usr/local/lib/python3.10/dist-packages (from keyring<25.0.0,>=24.0.0->poetry) (0.8.0)
Requirement already satisfied: SecretStorage>=3.2 in /usr/local/lib/python3.10/dist-packages (from keyring<25.0.0,>=24.0.0->poetry) (3.3.3)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.10/dist-packages (from pexpect<5.0.0,>=4.7.0->poetry) (0.7.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3.0,>=2.26->poetry) (2023.11.17)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3.0,>=2.26->poetry) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3.0,>=2.26->poetry) (3.4)
Requirement already satisfied: distlib<1,>=0.3.7 in /usr/local/lib/python3.10/dist-packages (from virtualenv<21.0.0,>=20.23.0->poetry) (0.3.7)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/dist-packages (from importlib-metadata>=4.11.4->keyring<25.0.0,>=24.0.0->poetry) (3.17.0)
Requirement already satisfied: cryptography>=2.0 in /usr/local/lib/python3.10/dist-packages (from SecretStorage>=3.2->keyring<25.0.0,>=24.0.0->poetry) (41.0.5)
Requirement already satisfied: more-itertools in /usr/local/lib/python3.10/dist-packages (from jaraco.classes->keyring<25.0.0,>=24.0.0->poetry) (10.1.0)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/dist-packages (from cryptography>=2.0->SecretStorage>=3.2->keyring<25.0.0,>=24.0.0->poetry) (1.16.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/dist-packages (from cffi>=1.12->cryptography>=2.0->SecretStorage>=3.2->keyring<25.0.0,>=24.0.0->poetry) (2.21)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
poetry install 2/4 ✓
Creating virtualenv ultra-type-gW_DSdP6-py3.10 in /root/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...
Package operations: 14 installs, 0 updates, 0 removals
  • Installing typing-extensions (4.8.0)
  • Installing astroid (3.0.1)
  • Installing dill (0.3.7)
  • Installing exceptiongroup (1.2.0)
  • Installing iniconfig (2.0.0)
  • Installing isort (5.12.0)
  • Installing mccabe (0.7.0)
  • Installing packaging (23.2)
  • Installing platformdirs (4.0.0)
  • Installing pluggy (1.3.0)
  • Installing tomli (2.0.1)
  • Installing tomlkit (0.12.3)
  • Installing pylint (3.0.2)
  • Installing pytest (7.4.3)
Writing lock file
Installing the current project: ultra-type (0.1.0)
if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 3/4 ✓
(nothing was outputted)
./run_tests.sh ultra_type/controller.py 4/4 ✓
.                                                                        [100%]
1 passed, 24 deselected in 0.08s

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/eranheres/ultra_type/blob/714387971e8e6d8ba4e9c4efd0d20b4ba85ab089/tests/test_controller.py#L1-L2 https://github.com/eranheres/ultra_type/blob/714387971e8e6d8ba4e9c4efd0d20b4ba85ab089/ultra_type/controller.py#L1-L33 https://github.com/eranheres/ultra_type/blob/714387971e8e6d8ba4e9c4efd0d20b4ba85ab089/README.md#L1-L20 https://github.com/eranheres/ultra_type/blob/714387971e8e6d8ba4e9c4efd0d20b4ba85ab089/ultra_type/main.py#L1-L11 https://github.com/eranheres/ultra_type/blob/714387971e8e6d8ba4e9c4efd0d20b4ba85ab089/tests/test_language.py#L1-L79

Step 2: ⌨️ Coding

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:23:0: E0001: Parsing failed: 'expected an indented block after function definition on line 22 (, line 23)' (syntax-error)

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:20:16: E1101: Instance of 'Controller' has no 'show_stats' member (no-member)
ultra_type/controller.py:76:4: E0102: function already defined line 59 (function-redefined)

Next, remove the duplicate definition of show_stats. This method is defined twice in the Controller class, which is causing the second error. The first definition of show_stats is correct and should be kept, while the second definition should be removed.

Finally, correct the indentation of the practice and show_stats methods. These methods are currently indented one level too far, which is causing them to be defined inside the run method instead of the Controller class.

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:43:12: E0001: Parsing failed: 'unexpected indent (, line 43)' (syntax-error)

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:43:12: E0001: Parsing failed: 'unexpected indent (, line 43)' (syntax-error)

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:20:16: E1101: Instance of 'Controller' has no 'show_stats' member (no-member)
ultra_type/controller.py:76:4: E0102: function already defined line 59 (function-redefined)

if [[ "ultra_type/controller.py" == *.py ]]; then PYTHONPATH=. poetry run pylint --errors-only ultra_type/controller.py; else exit 0; fi 1/1 ❌ (`2`)
************* Module ultra_type.controller
ultra_type/controller.py:23:0: E0001: Parsing failed: 'expected an indented block after function definition on line 22 (, line 23)' (syntax-error)


Step 3: 🔁 Code Review

Working on it...


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord