Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Data i/o docstring format (#309)

Wendong-Fan3c2f6bebb014
diff --git a/camel/functions/data_io_functions.py b/camel/functions/data_io_functions.py
index 0a9450060..59db784fe 100644
--- a/camel/functions/data_io_functions.py
+++ b/camel/functions/data_io_functions.py
@@ -25,7 +25,7 @@ from bs4 import BeautifulSoup
class File(ABC):
- """Represents an uploaded file comprised of Documents"""
+ r"""Represents an uploaded file comprised of Documents"""
def __init__(
self,
@@ -34,7 +34,8 @@ class File(ABC):
metadata: Optional[Dict[str, Any]] = None,
docs: Optional[List[Dict[str, Any]]] = None,
):
- """
+ r"""
+
Args:
name (str): The name of the file.
id (str): The unique identifier of the file.
@@ -51,8 +52,7 @@ class File(ABC):
@classmethod
@abstractmethod
def from_bytes(cls, file: BytesIO) -> "File":
- """
- Creates a File object from a BytesIO object.
+ r"""Creates a File object from a BytesIO object.
Args:
file (BytesIO):
@@ -71,7 +71,8 @@ class File(ABC):
f"File(name={self.name}, id={self.id}, metadata={self.metadata})")
def copy(self) -> "File":
- """Create a deep copy of this File"""
+ r"""Create a deep copy of this File"""
+
return self.__class__(
name=self.name,
id=self.id,
@@ -81,8 +82,7 @@ class File(ABC):
def strip_consecutive_newlines(text: str) -> str:
- """
- Strips consecutive newlines from a string.
+ r"""Strips consecutive newlines from a string.
Args:
text (str): The string to strip.
@@ -97,8 +97,7 @@ class DocxFile(File):
@classmethod
def from_bytes(cls, file: BytesIO) -> "DocxFile":
- """
- Creates a DocxFile object from a BytesIO object.
+ r"""Creates a DocxFile object from a BytesIO object.
Args:
file (BytesIO):
@@ -123,8 +122,7 @@ class PdfFile(File):
@classmethod
def from_bytes(cls, file: BytesIO) -> "PdfFile":
- """
- Creates a PdfFile object from a BytesIO object.
+ r"""Creates a PdfFile object from a BytesIO object.
Args:
file (BytesIO):
@@ -153,8 +151,7 @@ class TxtFile(File):
@classmethod
def from_bytes(cls, file: BytesIO) -> "TxtFile":
- """
- Creates a TxtFile object from a BytesIO object.
+ r"""Creates a TxtFile object from a BytesIO object.
Args:
file (BytesIO):
@@ -179,8 +176,7 @@ class JsonFile(File):
@classmethod
def from_bytes(cls, file: BytesIO) -> "JsonFile":
- """
- Creates a JsonFile object from a BytesIO object.
+ r"""Creates a JsonFile object from a BytesIO object.
Args:
file (BytesIO):
@@ -204,8 +200,7 @@ class HtmlFile(File):
@classmethod
def from_bytes(cls, file: BytesIO) -> "HtmlFile":
- """
- Creates a HtmlFile object from a BytesIO object.
+ r"""Creates a HtmlFile object from a BytesIO object.
Args:
file (BytesIO):
@@ -228,8 +223,7 @@ class HtmlFile(File):
def read_file(file: BytesIO) -> File:
- """
- Reads an uploaded file and returns a File object.
+ r"""Reads an uploaded file and returns a File object.
Args:
file (BytesIO): A BytesIO object representing the contents of the file.