<commit_before>'''
Configuration of the alternatives system
========================================

Control the alternatives system

.. code-block:: yaml

  hadoop-0.20-conf:
    alternatives.install:
      - name: hadoop-0.20-conf
      - link: /etc/hadoop-0.20/conf
      - path: /opt/hadoop/conf
      - priority: 30

  hadoop-0.20-conf:
    alternatives:
        - remove
        - name: hadoop-0.20-conf
        - path: /opt/hadoop/conf
    
'''

def install(name, link, path, priority):
    '''
    Install new alternative for defined <name>

    name
        is the master name for this link group
        (e.g. pager)

    link
        is the symlink pointing to /etc/alternatives/<name>.
        (e.g. /usr/bin/pager)

    path
        is the location of one of the alternative target files.
        (e.g. /usr/bin/less) 

    priority
        is an integer; options with higher numbers have higher priority in
        automatic mode.
    '''
    ret = {'name': name,
           'link': link,
           'path': path,
           'priority': priority,
           'result': True,
           'changes': {},
           'comment': ''}

    isinstalled = __salt__['alternatives.check_installed'](name, path)
    if not isinstalled:
        __salt__['alternatives.install'](name, link, path, priority)
        ret['comment'] = (
            'Setting alternative for {0} to {1} with priority {2}'
        ).format(name, path, priority)
        ret['changes'] =  {'name': name,
                          'link': link,
                          'path': path,<commit_msg>improve alternatives system doc string<commit_after>'''
Configuration of the alternatives system
========================================

Control the alternatives system

.. code-block:: yaml

  {% set my_hadoop_conf = '/opt/hadoop/conf' %}

  {{ my_hadoop_conf }}:
    file.directory

  hadoop-0.20-conf:
    alternatives.install:
      - name: hadoop-0.20-conf
      - link: /etc/hadoop-0.20/conf
      - path: {{ my_hadoop_conf }}
      - priority: 30
      - require:
        - file: {{ my_hadoop_conf }}

  hadoop-0.20-conf:
    alternatives.remove:
        - name: hadoop-0.20-conf
        - path: {{ my_hadoop_conf }}

'''

def install(name, link, path, priority):
    '''
    Install new alternative for defined <name>

    name
        is the master name for this link group
        (e.g. pager)

    link
        is the symlink pointing to /etc/alternatives/<name>.
        (e.g. /usr/bin/pager)

    path
        is the location of the new alternative target.
        NB: This file / directory must already exist.
        (e.g. /usr/bin/less)

    priority
        is an integer; options with higher numbers have higher priority in
        automatic mode.
    '''
    ret = {'name': name,
           'link': link,
           'path': path,
           'priority': priority,
           'result': True,
           'changes': {},
           'comment': ''}

    isinstalled = __salt__['alternatives.check_installed'](name, path)
    if not isinstalled:
        __salt__['alternatives.install'](name, link, path, priority)
        ret['comment'] = (
            'Setting alternative for {0} to {1} with priority {2}'
        ).format(name, path, priority)
        ret['changes'] =  {'name': name,
                          'link': link,
                          'path': path,
{'fraction_non_alphanumeric': 0.14468973747016706, 'fraction_numerical': 0.011933174224343675, 'mean_word_length': 1.9335083114610674, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1047649', 'n_tokens_mistral': 1002, 'n_tokens_neox': 955, 'n_words': 275}