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: Enhance extract_class_name function to identify Component subclasses #4492

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

ogabrielluiz
Copy link
Contributor

@ogabrielluiz ogabrielluiz commented Nov 11, 2024

This pull request includes improvements to the extract_class_name function in the src/backend/base/langflow/utils/validate.py file. The changes enhance the function's robustness and readability by adding type annotations, a detailed docstring, and additional error handling.

Improvements to extract_class_name function:

  • Added type annotations to specify that the code parameter is a string and the function returns a string.
  • Included a detailed docstring that describes the function's purpose, arguments, return value, and potential exceptions.
  • Enhanced error handling by adding a try-except block to catch SyntaxError exceptions and raise a ValueError with a descriptive message.
  • Improved the logic for checking class inheritance by iterating through the bases of class definitions and checking for inheritance from Component or LC. This can be improved to a more generic solution but it fixes the problem for now

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Nov 11, 2024
@github-actions github-actions bot added bug Something isn't working and removed enhancement New feature or request bug Something isn't working labels Nov 11, 2024
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) November 11, 2024 12:43
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 11, 2024
Copy link

codspeed-hq bot commented Nov 11, 2024

CodSpeed Performance Report

Merging #4492 will degrade performances by 12.94%

Comparing fix-class-eval (a295b5b) with main (357c587)

Summary

⚡ 2 improvements
❌ 1 regressions
✅ 12 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main fix-class-eval Change
test_invalid_run_with_input_type_chat 16.5 ms 18.9 ms -12.94%
test_successful_run_with_input_type_text 527.2 ms 429.2 ms +22.83%
test_successful_run_with_output_type_debug 449.7 ms 405.4 ms +10.93%

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 11, 2024
@ogabrielluiz ogabrielluiz merged commit f43fd89 into main Nov 11, 2024
34 of 35 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-class-eval branch November 11, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants