Import beautifulsoup pacakge lazily. (#964)
This commit is contained in:
@@ -5,7 +5,6 @@ import re
|
|||||||
import string
|
import string
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from schema import Optional, Or, Schema
|
from schema import Optional, Or, Schema
|
||||||
|
|
||||||
from embedchain.models.data_type import DataType
|
from embedchain.models.data_type import DataType
|
||||||
@@ -16,6 +15,8 @@ def parse_content(content, type):
|
|||||||
if type not in implemented:
|
if type not in implemented:
|
||||||
raise ValueError(f"Parser type {type} not implemented. Please choose one of {implemented}")
|
raise ValueError(f"Parser type {type} not implemented. Please choose one of {implemented}")
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
soup = BeautifulSoup(content, type)
|
soup = BeautifulSoup(content, type)
|
||||||
original_size = len(str(soup.get_text()))
|
original_size = len(str(soup.get_text()))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user