Skip to content

Commit

Permalink
Fix TypeErrors from new pydantic version
Browse files Browse the repository at this point in the history
  • Loading branch information
TupleType authored Oct 13, 2024
1 parent 5b68cf1 commit 9149f0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libs/community/langchain_community/document_loaders/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def __post_init__(self) -> None:

@model_validator(mode="before")
@classmethod
def validate_channel_or_videoIds_is_set(cls, values: Dict[str, Any]) -> Any:
"""Validate that either folder_id or document_ids is set, but not both."""
def validate_credentials_path_or_service_account_path_is_set(cls, values: Dict[str, Any]) -> Any:

Check failure on line 55 in libs/community/langchain_community/document_loaders/youtube.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.12

Ruff (E501)

langchain_community/document_loaders/youtube.py:55:89: E501 Line too long (101 > 88)

Check failure on line 55 in libs/community/langchain_community/document_loaders/youtube.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.9

Ruff (E501)

langchain_community/document_loaders/youtube.py:55:89: E501 Line too long (101 > 88)
"""Validate that either folder_id or document_ids is set."""

if not values.get("credentials_path") and not values.get(
if not values.kwargs.get("credentials_path") and not values.kwargs.get(
"service_account_path"
):
raise ValueError("Must specify either channel_name or video_ids")
Expand Down Expand Up @@ -393,8 +393,8 @@ def _build_youtube_client(self, creds: Any) -> Any:
@model_validator(mode="before")
@classmethod
def validate_channel_or_videoIds_is_set(cls, values: Dict[str, Any]) -> Any:
"""Validate that either folder_id or document_ids is set, but not both."""
if not values.get("channel_name") and not values.get("video_ids"):
"""Validate that either channel_name or video_ids is set."""
if not values.kwargs.get("channel_name") and not values.kwargs.get("video_ids"):
raise ValueError("Must specify either channel_name or video_ids")
return values

Expand Down

0 comments on commit 9149f0d

Please sign in to comment.