Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prompt_id): attribute missing error #1509

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Conversation

ArslanSaleem
Copy link
Collaborator

@ArslanSaleem ArslanSaleem commented Jan 9, 2025

Important

Fix missing attribute error in code_cleaning.py by replacing prompt_id with last_prompt_id and add tests for _handle_charts().

  • Bug Fix:
    • In code_cleaning.py, replace self.context.prompt_id with self.context.last_prompt_id in _handle_charts() to fix missing attribute error.
  • Imports:
    • Reorder imports in __init__.py, base.py, chart.py, dataframe.py, and parser.py for consistency.
  • Tests:
    • Add unit tests for _handle_charts() in test_code_cleaning.py to verify behavior when save_charts is true or false, and when code is empty or lacks PNG references.

This description was created by Ellipsis for 8fc1efa. It will automatically update as commits are pushed.

@ArslanSaleem ArslanSaleem requested a review from gventuri January 9, 2025 17:20
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 9, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 967a15f in 19 seconds

More details
  • Looked at 103 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. tests/unit_tests/core/code_generation/test_code_cleaning.py:211
  • Draft comment:
    The last_prompt_id is set in the context for test_handle_charts_save_charts_false, but it is not used in the logic when save_charts is False. Consider removing it for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR changes the attribute from prompt_id to last_prompt_id in the _handle_charts method. This change is reflected in the test test_handle_charts_save_charts_true, but the test test_handle_charts_save_charts_false still uses last_prompt_id even though it should not affect the logic when save_charts is False. The test logic is correct, but the context setup is unnecessary for last_prompt_id.
2. tests/unit_tests/core/code_generation/test_code_cleaning.py:180
  • Draft comment:
    The word 'reclaration' in the docstring should be corrected to 're-declaration'.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_JIx7M9yjxzDQ23ps


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jan 9, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 8fc1efa in 32 seconds

More details
  • Looked at 138 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. pandasai/core/response/__init__.py:1
  • Draft comment:
    Reordering imports is generally a style preference. Ensure this aligns with the project's style guide or serves a specific purpose.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The import statements in the __init__.py file have been reordered. This change is not necessary unless it serves a specific purpose, such as grouping related imports together or following a style guide. However, it doesn't affect functionality.
2. pandasai/core/response/base.py:2
  • Draft comment:
    The import order was changed. Ensure this aligns with the project's style guide.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The import statement for Any in base.py was moved. This change is minor and doesn't affect functionality, but it should be consistent with the project's style guide.
3. pandasai/core/response/chart.py:3
  • Draft comment:
    The import order was changed. Ensure this aligns with the project's style guide.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The import statement for Any in chart.py was moved. This change is minor and doesn't affect functionality, but it should be consistent with the project's style guide.
4. pandasai/dataframe/base.py:15
  • Draft comment:
    The import order was changed. Ensure this aligns with the project's style guide.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The import statement for BaseResponse in base.py was moved. This change is minor and doesn't affect functionality, but it should be consistent with the project's style guide.

Workflow ID: wflow_bEqhoJESFbjpjifR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@gventuri gventuri merged commit 6d0eabe into release/v3 Jan 9, 2025
12 checks passed
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.45%. Comparing base (63e8c26) to head (8fc1efa).
Report is 106 commits behind head on release/v3.

❗ There is a different number of reports uploaded between BASE (63e8c26) and HEAD (8fc1efa). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (63e8c26) HEAD (8fc1efa)
1 0
Additional details and impacted files
@@              Coverage Diff               @@
##           release/v3    #1509      +/-   ##
==============================================
- Coverage       79.09%   73.45%   -5.64%     
==============================================
  Files             149       68      -81     
  Lines            6013     2223    -3790     
==============================================
- Hits             4756     1633    -3123     
+ Misses           1257      590     -667     
Flag Coverage Δ
unittests 73.45% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants