mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
feat: add crewai-tools workspace and fix tests/dependencies
* feat: add crewai-tools workspace structure * Squashed 'temp-crewai-tools/' content from commit 9bae5633 git-subtree-dir: temp-crewai-tools git-subtree-split: 9bae56339096cb70f03873e600192bd2cd207ac9 * feat: configure crewai-tools workspace package with dependencies * fix: apply ruff auto-formatting to crewai-tools code * chore: update lockfile * fix: don't allow tool tests yet * fix: comment out extra pytest flags for now * fix: remove conflicting conftest.py from crewai-tools tests * fix: resolve dependency conflicts and test issues - Pin vcrpy to 7.0.0 to fix pytest-recording compatibility - Comment out types-requests to resolve urllib3 conflict - Update requests requirement in crewai-tools to >=2.32.0
This commit is contained in:
131
lib/crewai-tools/src/crewai_tools/printer.py
Normal file
131
lib/crewai-tools/src/crewai_tools/printer.py
Normal file
@@ -0,0 +1,131 @@
|
||||
"""Utility for colored console output."""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Printer:
|
||||
"""Handles colored console output formatting."""
|
||||
|
||||
@staticmethod
|
||||
def print(content: str, color: Optional[str] = None) -> None:
|
||||
"""Prints content with optional color formatting.
|
||||
|
||||
Args:
|
||||
content: The string to be printed.
|
||||
color: Optional color name to format the output. If provided,
|
||||
must match one of the _print_* methods available in this class.
|
||||
If not provided or if the color is not supported, prints without
|
||||
formatting.
|
||||
"""
|
||||
if hasattr(Printer, f"_print_{color}"):
|
||||
getattr(Printer, f"_print_{color}")(content)
|
||||
else:
|
||||
print(content)
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_purple(content: str) -> None:
|
||||
"""Prints content in bold purple color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold purple.
|
||||
"""
|
||||
print(f"\033[1m\033[95m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_green(content: str) -> None:
|
||||
"""Prints content in bold green color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold green.
|
||||
"""
|
||||
print(f"\033[1m\033[92m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_purple(content: str) -> None:
|
||||
"""Prints content in purple color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in purple.
|
||||
"""
|
||||
print(f"\033[95m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_red(content: str) -> None:
|
||||
"""Prints content in red color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in red.
|
||||
"""
|
||||
print(f"\033[91m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_blue(content: str) -> None:
|
||||
"""Prints content in bold blue color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold blue.
|
||||
"""
|
||||
print(f"\033[1m\033[94m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_yellow(content: str) -> None:
|
||||
"""Prints content in yellow color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in yellow.
|
||||
"""
|
||||
print(f"\033[93m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_yellow(content: str) -> None:
|
||||
"""Prints content in bold yellow color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold yellow.
|
||||
"""
|
||||
print(f"\033[1m\033[93m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_cyan(content: str) -> None:
|
||||
"""Prints content in cyan color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in cyan.
|
||||
"""
|
||||
print(f"\033[96m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_cyan(content: str) -> None:
|
||||
"""Prints content in bold cyan color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold cyan.
|
||||
"""
|
||||
print(f"\033[1m\033[96m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_magenta(content: str) -> None:
|
||||
"""Prints content in magenta color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in magenta.
|
||||
"""
|
||||
print(f"\033[35m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_bold_magenta(content: str) -> None:
|
||||
"""Prints content in bold magenta color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in bold magenta.
|
||||
"""
|
||||
print(f"\033[1m\033[35m {content}\033[00m")
|
||||
|
||||
@staticmethod
|
||||
def _print_green(content: str) -> None:
|
||||
"""Prints content in green color.
|
||||
|
||||
Args:
|
||||
content: The string to be printed in green.
|
||||
"""
|
||||
print(f"\033[32m {content}\033[00m")
|
||||
Reference in New Issue
Block a user