amkyawdev's picture
Upload folder using huggingface_hub
a7d7463 verified
Raw
History Blame Contribute Delete
1.29 kB
"""Animation Configuration"""
from dataclasses import dataclass
from enum import Enum
class ColorMode(Enum):
"""Color mode options"""
AUTO = "auto"
ALWAYS = "always"
NEVER = "never"
@dataclass
class AnimationConfig:
"""Configuration for terminal animations"""
speed: float = 0.05
color_enabled: bool = True
color_mode: ColorMode = ColorMode.AUTO
default_frames: int = 30
particle_count: int = 50
SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
PROGRESS_CHARS = "█▓▒░"
@classmethod
def from_env(cls) -> "AnimationConfig":
"""Create config from environment variables"""
import os
return cls(
speed=float(os.getenv("ANIMATION_SPEED", "0.05")),
color_enabled=os.getenv("ANIMATION_COLOR", "true").lower() == "true",
)
def should_use_color(self) -> bool:
"""Check if color should be used"""
if not self.color_enabled:
return False
if self.color_mode == ColorMode.ALWAYS:
return True
elif self.color_mode == ColorMode.NEVER:
return False
else:
import sys
return sys.stdout.isatty()
DEFAULT_CONFIG = AnimationConfig()