-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor(Pipelines) : Smart Data Frame Pipeline (Sourcery refactored) #740
Conversation
dcdfd68
to
4331da9
Compare
Important Auto Review SkippedBot user detected. To trigger a single review, invoke the TipsChat with CodeRabbit Bot (
|
4331da9
to
eb620b0
Compare
eb620b0
to
d4d494d
Compare
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 |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
|
||
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 |
There was a problem hiding this comment.
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:
- Use x is None rather than x == None (
none-compare
)
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
|
||
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 |
There was a problem hiding this comment.
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:
- Use x is None rather than x == None (
none-compare
)
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
assert result == None | ||
assert result is None |
There was a problem hiding this comment.
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:
- Use x is None rather than x == None (
none-compare
)
Codecov Report
❗ 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! |
* 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]>
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:Help us improve this pull request!