<commit_before>"""List the profiles

Copyright (c) 2015 <NAME>
MIT Licence
"""

import os

import colorama

from dodocs import utils
from dodocs.logger import getLogger


def plist(args):
    """List the profiles

    Parameters
    ----------
    args : namespace
        parsed command line arguments
    """
    log = getLogger()

    log.debug("Listing profiles")
    dodocs_dir = utils.dodocs_directory()
    dirpath, dirnames = next(os.walk(dodocs_dir))[:2]
    if dirnames:
        print(colorama.Fore.GREEN + "Available profiles:")
        for d in dirnames:
            profile_dir = os.path.join(dodocs_dir, d)
            msg = "  * {}".format(d)
            if os.path.islink(profile_dir):
                msg += " (-> {})".format(os.path.realpath(profile_dir))
            print(msg)
    else:
        print(colorama.Fore.RED + "No profile found")<commit_msg>List projects in profiles<commit_after>"""List the profiles

Copyright (c) 2015 <NAME>
MIT Licence
"""

import os

import colorama

import dodocs.config as dconf
from dodocs import utils
from dodocs.logger import getLogger


def plist(args):
    """List the profiles

    Parameters
    ----------
    args : namespace
        parsed command line arguments
    """
    log = getLogger()

    log.debug("Listing profiles")
    dodocs_dir = utils.dodocs_directory()
    dirpath, dirnames = next(os.walk(dodocs_dir))[:2]
    if dirnames:
        msg = colorama.Fore.GREEN + "Available profiles:" + colorama.Fore.RESET
        for d in dirnames:
            profile_dir = os.path.join(dodocs_dir, d)
            msg += "\n  * {}".format(d)
            if os.path.islink(profile_dir):
                msg += " (-> {})".format(os.path.realpath(profile_dir))
            try:
                for project in dconf.get_projects(d):
                    msg += "\n    + {}".format(project)
            except dconf.DodocConfigError as e:
                msg += ("\n    + " + colorama.Fore.RED + "there is a problem"
                        "with the configuration file" + colorama.Fore.RESET)
                log.error(e)

        print(msg)
    else:
        print(colorama.Fore.RED + "No profile found")
{'fraction_non_alphanumeric': 0.12511542012927054, 'fraction_numerical': 0.0046168051708217915, 'mean_word_length': 2.1315028901734103, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '5290617', 'n_tokens_mistral': 685, 'n_tokens_neox': 658, 'n_words': 166}