mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
Update simplemind/chains/reverse_text.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2,5 +2,24 @@ from .base import BaseChain
|
||||
|
||||
|
||||
class ReverseTextChain(BaseChain):
|
||||
def run(self, input_data):
|
||||
"""Chain that reverses input text.
|
||||
|
||||
This chain takes a text input and returns it reversed. For example,
|
||||
"hello" becomes "olleh".
|
||||
"""
|
||||
|
||||
def run(self, input_data: str) -> str:
|
||||
"""Reverse the input text.
|
||||
|
||||
Args:
|
||||
input_data: The text to reverse.
|
||||
|
||||
Returns:
|
||||
The reversed text.
|
||||
|
||||
Raises:
|
||||
TypeError: If input_data is not a string.
|
||||
"""
|
||||
if not isinstance(input_data, str):
|
||||
raise TypeError("Input must be a string")
|
||||
return input_data[::-1]
|
||||
|
||||
Reference in New Issue
Block a user