mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-24 03:52:10 +00:00
core: Add ruff rules D (docstring) (#29406)
This ensures that the code is properly documented: https://docs.astral.sh/ruff/rules/#pydocstyle-d Related to #21983
This commit is contained in:
committed by
GitHub
parent
64df60e690
commit
88b4233fa1
@@ -1,4 +1,6 @@
|
||||
"""**Document** module is a collection of classes that handle documents
|
||||
"""Documents module.
|
||||
|
||||
**Document** module is a collection of classes that handle documents
|
||||
and their transformations.
|
||||
|
||||
"""
|
||||
|
@@ -1,3 +1,5 @@
|
||||
"""Base classes for media and documents."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
@@ -45,6 +47,11 @@ class BaseMedia(Serializable):
|
||||
|
||||
@field_validator("id", mode="before")
|
||||
def cast_id_to_str(cls, id_value: Any) -> Optional[str]:
|
||||
"""Coerce the id field to a string.
|
||||
|
||||
Args:
|
||||
id_value: The id value to coerce.
|
||||
"""
|
||||
if id_value is not None:
|
||||
return str(id_value)
|
||||
else:
|
||||
@@ -291,7 +298,10 @@ class Document(BaseMedia):
|
||||
|
||||
@classmethod
|
||||
def get_lc_namespace(cls) -> list[str]:
|
||||
"""Get the namespace of the langchain object."""
|
||||
"""Get the namespace of the langchain object.
|
||||
|
||||
Default namespace is ["langchain", "schema", "document"].
|
||||
"""
|
||||
return ["langchain", "schema", "document"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
@@ -1,3 +1,5 @@
|
||||
"""Document compressor."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
@@ -1,3 +1,5 @@
|
||||
"""Document transformers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
Reference in New Issue
Block a user