Path.home

Path.home(...)

Description

Documentation for Path.home.

Python Python Pathlib Official Docs

Real-World Examples

Practical code examples showing how Path.home is used in real projects.

# Flask app for health checks
app = Flask(__name__)
bot = None  # Initialize bot variable

@app.route('/')
def home():
    return "🤖 GitHub Discord Bot is running!"

@app.route('/health')
def health():
    """Enhanced health check for Render"""
    try:
        bot_status = "offline"
        guild_count = 0
        target_guild = "not_connected"

        if bot and hasattr(bot, 'is_ready') and bot.is_ready():
            bot_status = "online"
            guild_count = len(bot.guilds) if hasattr(bot, 'guilds') else 0

            if GUILD_ID and hasattr(bot, 'get_guild'):
                target_guild = "connected" if bot.get_guild(GUILD_ID) else "not_found"

        return jsonify({
            "status": "healthy",
_orchestrator: Orchestrator | None = None
_config: Any = None

# Research data storage
RESEARCH_DIR = Path.home() / ".gru" / "research"

def set_research_dependencies(config: Any, orchestrator: Orchestrator) -> None:
    """Set dependencies for research tools."""
    global _config, _orchestrator
    _config = config
    _orchestrator = orchestrator
    RESEARCH_DIR.mkdir(parents=True, exist_ok=True)

async def _fetch_json(url: str, headers: dict | None = None) -> dict | list | None:
    """Fetch JSON from URL."""
    try:
        async with aiohttp.ClientSession() as session, session.get(url, headers=headers, timeout=30) as resp:
            if resp.status == 200:
                return await resp.json()
            logger.warning(f"HTTP {resp.status} fetching {url}")
            return None
    except Exception as e: