Skip to content

Commit

Permalink
update: import bs4 lazily.
Browse files Browse the repository at this point in the history
This commit lazily loads the bs4 import.
This is needed so that not everyone has to
install the bs4 package
  • Loading branch information
taranjeet committed Nov 17, 2023
1 parent 023a614 commit 5724c5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion embedchain/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import string
from typing import Any

from bs4 import BeautifulSoup
from schema import Optional, Or, Schema

from embedchain.models.data_type import DataType
Expand All @@ -16,6 +15,8 @@ def parse_content(content, type):
if type not in implemented:
raise ValueError(f"Parser type {type} not implemented. Please choose one of {implemented}")

from bs4 import BeautifulSoup

Check warning on line 18 in embedchain/utils.py

View check run for this annotation

Codecov / codecov/patch

embedchain/utils.py#L18

Added line #L18 was not covered by tests

soup = BeautifulSoup(content, type)
original_size = len(str(soup.get_text()))

Expand Down

0 comments on commit 5724c5d

Please sign in to comment.