#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
edapy is a tool for exploratory data analysis with Python.

You can use it to get a first idea what a CSV is about or to get an overview
over a directory of PDF files.
"""

# core modules
import collections

# 3rd party modules
import click
import yaml

# local modules
import edapy.csv
import edapy.images
import edapy.pdf


def setup_yaml():
    """
    Make yaml.dump print collections.OrderedDict the right way.

    https://stackoverflow.com/a/8661021
    """
    represent_dict_order = (lambda self, data:
                            self.represent_mapping('tag:yaml.org,2002:map',
                                                   data.items()))
    yaml.add_representer(collections.OrderedDict, represent_dict_order)


setup_yaml()


@click.group(help=__doc__)
@click.version_option(version=edapy.__version__)
def entry_point():
    pass


entry_point.add_command(edapy.csv.entry_point)
entry_point.add_command(edapy.pdf.entry_point)
entry_point.add_command(edapy.images.entry_point)


if __name__ == '__main__':
    entry_point()
