<commit_before>import os
import os.path as op
try:
    from conda_build.metadata import MetaData
except Exception as e:
    import traceback
    traceback.print_exc()
    raise e
from distutils.version import LooseVersion
#import matplotlib
#matplotlib.use("agg")
#import matplotlib.pyplot as plt
#from wordcloud import WordCloud


BASE_DIR = op.dirname(op.abspath(__file__))
RECIPE_DIR = op.join(op.dirname(BASE_DIR), 'recipes')
OUTPUT_DIR = op.join(BASE_DIR, 'recipes')

README_TEMPLATE = u"""\
.. _`{title}`:

{title}
{title_underline}

|downloads|

{summary}

======== ===========
Home     {home}
Versions {versions}
License  {license}
Recipe   {recipe}
======== ===========

Installation
------------

.. highlight: bash

With an activated Bioconda channel (see :ref:`setup`), install with::

   conda install {title}

and update with::

   conda update {title}

{notes}

[![Docker Repository on Quay](https://quay.io/repository/biocontainers/{title}/status "Docker Repository on Quay")](https://quay.io/repository/biocontainers/{title})

A [Docker](https://www.docker.com) and [rkt](https://coreos.com/rkt/) 
container is available at https://quay.io/repository/biocontainers/{title}.

Link to this page
-----------------

Render an |badge| badge with the following Markdown::

   [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/{title}/README.html)

.. |badge| image:: https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square
           :target: http://bioconda.github.io/recipes/{title}/README.html
.. |downloads| image:: https://anaconda.org/bioconda/{title}/badges/downloads.svg
               :target: https://anaconda.org/bioconda/{title}
"""


def setup(*args):
    """
    Go through every folder in the `bioconda-recipes/recipes` dir
    and generate a README.rst file.
    """
    print('Generating package READMEs...')
    # TODO obtain information from repodata.json.
    summaries = []
    for folder in os.listdir(RECIPE_DIR):
        # Subfolders correspond to different versions<commit_msg>Fix doc generation<commit_after>import os
import os.path as op
try:
    from conda_build.metadata import MetaData
except Exception as e:
    import traceback
    traceback.print_exc()
    raise e
from distutils.version import LooseVersion
#import matplotlib
#matplotlib.use("agg")
#import matplotlib.pyplot as plt
#from wordcloud import WordCloud


BASE_DIR = op.dirname(op.abspath(__file__))
RECIPE_DIR = op.join(op.dirname(BASE_DIR), 'recipes')
OUTPUT_DIR = op.join(BASE_DIR, 'recipes')

README_TEMPLATE = u"""\
.. _`{title}`:

{title}
{title_underline}

|downloads|

{summary}

======== ===========
Home     {home}
Versions {versions}
License  {license}
Recipe   {recipe}
======== ===========

Installation
------------

.. highlight: bash

With an activated Bioconda channel (see :ref:`setup`), install with::

   conda install {title}

and update with::

   conda update {title}

{notes}

|docker|

A Docker container is available at https://quay.io/repository/biocontainers/{title}.

Link to this page
-----------------

Render an |badge| badge with the following Markdown::

   [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/{title}/README.html)

.. |badge| image:: https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square
           :target: http://bioconda.github.io/recipes/{title}/README.html
.. |downloads| image:: https://anaconda.org/bioconda/{title}/badges/downloads.svg
               :target: https://anaconda.org/bioconda/{title}
.. |docker| image:: https://quay.io/repository/biocontainers/{title}/status
                :target: https://quay.io/repository/biocontainers/{title}


"""


def setup(*args):
    """
    Go through every folder in the `bioconda-recipes/recipes` dir
    and generate a README.rst file.
    """
    print('Generating package READMEs...')
    # TODO obtain information from repodata.json.
    summaries = []
    for folder in os.listdir(RECIPE_DIR):
        # Subfolders correspond to different versions
{'fraction_non_alphanumeric': 0.16287878787878787, 'fraction_numerical': 0.001893939393939394, 'mean_word_length': 3.8230593607305936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '473100', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1376, 'n_words': 307}