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

⚡️ Speed up method AddContentToPage.is_table by 13% in src/backend/base/langflow/components/Notion/add_content_to_page.py #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ def is_table(self, text):
has_separator = False
for i, row in enumerate(rows):
if "|" in row:
cells = [cell.strip() for cell in row.split("|")]
cells = [cell for cell in cells if cell] # Remove empty cells
if i == 1 and all(set(cell) <= set("-|") for cell in cells):
has_separator = True
cells = row.split("|")
cells = [cell.strip() for cell in cells if cell.strip()] # Combine strip and filter in one step
if i == 1:
if all(cell == "-" * len(cell) for cell in cells):
has_separator = True
elif not cells:
return False

Expand Down