<commit_before>import re
import os


_GITHUB_URL = "https://github.com"

STATE_UNLINK = "unlink"
STATE_CONFLICT = "conflict"
STATE_LINKED = "linked"


def get_github_url(repo):
    return _GITHUB_URL + "/" + repo + ".git"


def get_sheet_path(repo):
    return os.path.join(
        get_cheat_path(),
        ".ext",
        repo.replace("/", "_"))


def get_cheat_path():
    return os.path.join(
        os.path.expanduser("~"),
        ".cheat")


def get_available_sheets_at(sheet_dir):
    def is_available_sheet(sheet):
        return (
            not os.path.isdir(os.path.join(sheet_dir, sheet)) and
            re.match(r"^[a-zA-Z-_]+$", sheet))
    return list(filter(is_available_sheet, os.listdir(sheet_dir)))


def get_sheets_with_state(cheat_dir, sheet_dir, sheets):
    def append_state(sheet):
        cheat_path = os.path.join(cheat_dir, sheet)
        if not os.path.exists(cheat_path):
            return (sheet, STATE_UNLINK)
        elif (os.path.islink(cheat_path) and
              os.readlink(cheat_path) == os.path.join(sheet_dir, sheet)):<commit_msg>Sort available sheet<commit_after>import re
import os


_GITHUB_URL = "https://github.com"

STATE_UNLINK = "unlink"
STATE_CONFLICT = "conflict"
STATE_LINKED = "linked"


def get_github_url(repo):
    return _GITHUB_URL + "/" + repo + ".git"


def get_sheet_path(repo):
    return os.path.join(
        get_cheat_path(),
        ".ext",
        repo.replace("/", "_"))


def get_cheat_path():
    return os.path.join(
        os.path.expanduser("~"),
        ".cheat")


def get_available_sheets_at(sheet_dir):
    def is_available_sheet(sheet):
        return (
            not os.path.isdir(os.path.join(sheet_dir, sheet)) and
            re.match(r"^[a-zA-Z-_]+$", sheet))
    sheets = list(filter(is_available_sheet, os.listdir(sheet_dir)))
    sheets.sort()
    return sheets


def get_sheets_with_state(cheat_dir, sheet_dir, sheets):
    def append_state(sheet):
        cheat_path = os.path.join(cheat_dir, sheet)
        if not os.path.exists(cheat_path):
            return (sheet, STATE_UNLINK)
        elif (os.path.islink(cheat_path) and
              os.readlink(cheat_path) == os.path.join(sheet_dir, sheet)):
{'fraction_non_alphanumeric': 0.13824465666211916, 'fraction_numerical': 0.0, 'mean_word_length': 2.9711191335740073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '762550', 'n_tokens_mistral': 802, 'n_tokens_neox': 767, 'n_words': 136}