"""updates subreddit css with compiled sass"""
from os import path
import time
from typing import List, Dict, Any, Tuple

import praw
import sass

# leave my typedefs alone, pylint: disable=C0103
WebhookResponse = Dict[str, Any]


def css() -> str:
    """compiles sass and returns css"""
    return sass.compile(filename="index.scss", output_style="compressed")


def uid() -> str:
    """return date and time"""
    return "Subreddit upload on {}".format(time.strftime("%c"))


def changed_assets(data: WebhookResponse) -> Tuple[List[str], List[str]]:
    """
    identifies changed assets to upload or remove by checking if any changed files are images
    returns a tuple containing modified / new files and removed files
    """
    endings: List[str] = ["png", "jpg"]

    head_commit: Dict[str, Any] = data["head_commit"]

    uploading_files: List[str] = [
        file for file in (head_commit["modified"] + head_commit["added"])
        for ending in endings
        if path.splitext(file)[1] == ending
    ]

    # removed_files require a name, not file extension
    removed_files: List[str] = [
        path.splitext(file)[0] for file in head_commit["removed"]
        for ending in endings
        if path.splitext(file)[1] == ending
    ]
    return (uploading_files, removed_files)

def update(data: WebhookResponse) -> None:
    """main function"""
    reddit: praw.Reddit = praw.Reddit()
    reddit.subreddit("neoliberal").stylesheet.update(css(), reason=uid())
    return

@@ -1292,16 +1292,338 @@
 files)%0A%0A
+def changed_spreedsheet(data: WebhookResponse) -%3E bool:%0A    %22%22%22checks if any sass files have been changed%22%22%22%0A    ending: str = %22scss%22%0A    head_commit: Dict%5Bstr, Any%5D = data%5B%22head_commit%22%5D%0A    return any(%0A        path.splitext(file)%5B1%5D == ending%0A        for file in (head_commit%5B%22modified%22%5D + head_commit%5B%22added%22%5D)%0A    )%0A%0A%0A
 def upda

Add file to check if stylesheet has been updated