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

refactor(Pipelines) : Smart Data Frame Pipeline (Sourcery refactored) #740

Merged

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Nov 8, 2023

Pull Request #735 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the improvement/refactor_chat branch, then run:

git fetch origin sourcery/improvement/refactor_chat
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot force-pushed the sourcery/improvement/refactor_chat branch from dcdfd68 to 4331da9 Compare November 8, 2023 15:32
@sourcery-ai sourcery-ai bot requested a review from milind-sinaptik November 8, 2023 15:32
Copy link
Contributor

coderabbitai bot commented Nov 8, 2023

Important

Auto Review Skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@sourcery-ai sourcery-ai bot force-pushed the sourcery/improvement/refactor_chat branch from 4331da9 to eb620b0 Compare November 9, 2023 13:18
@sourcery-ai sourcery-ai bot force-pushed the sourcery/improvement/refactor_chat branch from eb620b0 to d4d494d Compare November 9, 2023 13:30
Comment on lines -40 to -49
generate_python_code_instruction = (
pipeline_context.query_exec_tracker.execute_func(
pipeline_context.get_intermediate_value("get_prompt"),
"generate_python_code",
default_prompt=GeneratePythonCodePrompt,
default_values=default_values,
)
return pipeline_context.query_exec_tracker.execute_func(
pipeline_context.get_intermediate_value("get_prompt"),
"generate_python_code",
default_prompt=GeneratePythonCodePrompt,
default_values=default_values,
)

return generate_python_code_instruction
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function PromptGeneration.execute refactored with the following changes:

pipeline_context = PipelineContext([sample_df], config)
return pipeline_context
return PipelineContext([sample_df], config)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestCodeExecution.context refactored with the following changes:

Comment on lines +129 to +138

context.get_intermediate_value = Mock(side_effect=mock_intermediate_values)

assert isinstance(code_execution, CodeExecution)

result = None
try:
result = code_execution.execute(input="Test Code", context=context, logger=logger)
except Exception as e:
assert result == None
assert result is None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestCodeExecution.test_code_execution_unsuccessful_after_retries refactored with the following changes:

pipeline_context = PipelineContext([sample_df], config)
return pipeline_context
return PipelineContext([sample_df], config)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestCodeGenerator.context refactored with the following changes:

pipeline_context = PipelineContext([sample_df], config)
return pipeline_context
return PipelineContext([sample_df], config)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestResultParsing.context refactored with the following changes:

Comment on lines -114 to +127

context._query_exec_tracker = Mock()
context.query_exec_tracker.execute_func = Mock(side_effect=mock_result_parsing)

def mock_intermediate_values(key : str):
if key == "response_parser" :
return mock_response_parser

context.get_intermediate_value = Mock(side_effect=mock_intermediate_values)

result = None
try:
result = result_parsing.execute(input="Test Result", context=context, logger=logger)
except Exception as e:
assert result == None
assert result is None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestResultParsing.test_result_parsing_unsuccessful_with_exceptions refactored with the following changes:

pipeline_context = PipelineContext([sample_df], config)
return pipeline_context
return PipelineContext([sample_df], config)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestResultValidation.context refactored with the following changes:

Comment on lines -99 to +98
assert result == None
assert result is None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestResultValidation.test_result_is_none refactored with the following changes:

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (improvement/refactor_chat@09386c4). Click here to learn what that means.
The diff coverage is n/a.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@                     Coverage Diff                      @@
##             improvement/refactor_chat     #740   +/-   ##
============================================================
  Coverage                             ?   85.26%           
============================================================
  Files                                ?       93           
  Lines                                ?     3890           
  Branches                             ?        0           
============================================================
  Hits                                 ?     3317           
  Misses                               ?      573           
  Partials                             ?        0           

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@gventuri gventuri merged commit 69fa4be into improvement/refactor_chat Nov 9, 2023
9 checks passed
gventuri added a commit that referenced this pull request Nov 12, 2023
* refactor(Pipelines) : Smart Data Frame Pipeline

* 'Refactored by Sourcery' (#736)

Co-authored-by: Sourcery AI <>

* refactor(Pipelines) : made changes according to PR review

* refactor(Pipelines) : Unit test cases added

* refactor(Pipelines) : Unit Test cases added cd /Users/milindlalwani/pandas-ai ; /usr/bin/env /Users/milindlalwani/anaconda3/envs/pandas-ai/bin/python /Users/milindlalwani/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 59121 -- /Users/milindlalwani/pandas-ai/examples/from_csv.py

* refactor(Pipelines) : Broken Test Cases Fixed

* refactor(Pipelines) : Skip Logic added and More Steps created for Data Smart Lake pipeline

* 'Refactored by Sourcery' (#740)

Co-authored-by: Sourcery AI <>

* refactor: move pipeline logic unit from sdf to pipelines folder

* refactor(Pipelines) : Merge Comflicts Fixed

* build: fix .lock file

---------

Co-authored-by: Milind Lalwani <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Gabriele Venturi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants