# Path: dlstats/constants.py
# CACHE_URL = os.environ.get('WIDUKIND_CACHE_URL', 'simple') #redis://localhost:6379/0
# SCHEMAS_VALIDATION_DISABLE = os.environ.get('WIDUKIND_SCHEMAS_VALIDATION_DISABLE', 'false')
# 
# Path: dlstats/client.py
# DLSTATS_SETTINGS = dict(auto_envvar_prefix='DLSTATS')
# DEFAULT_PATH_REQUESTS_CACHE = os.path.abspath(os.path.join(tempfile.gettempdir(), "dlstats"))
# class Context(object):
# class ComplexCLI(click.MultiCommand):
#     def __init__(self, mongo_url=None, verbose=False,
#                  log_level='ERROR', log_config=None, log_file=None,
#                  trace=False,
#                  cache_enable=False,  
#                  requests_cache_enable=None, requests_cache_path=None, 
#                  requests_cache_expire=None,               
#                  debug=False, silent=False, pretty=False, quiet=False):
#     def _set_log_file(self):
#     def _set_cache(self):
#     def _set_requests_cache(self):
#     def log(self, msg, *args):
#     def log_error(self, msg, *args):
#     def log_ok(self, msg, *args):
#     def log_warn(self, msg, *args):
#     def pretty_print(self, obj):
#     def mongo_client(self):
#     def lock(self, key, owner, timeout=None, expire=None):
#     def mongo_database(self):
#     def mongo_fs(self):
#     def list_commands(self, ctx):
#     def get_command(self, ctx, name):
# def cli():
# def main():
# 
# Path: dlstats/fetchers/schemas.py
# def date_validator(value):
# def typecheck(_type, msg=None):
#     def validator(value):


import time
import click
        import pymongo
from pprint import pprint
from widukind_common.utils import create_or_update_indexes
from widukind_common import tests_tools as utils
from dlstats import constants
from dlstats import client
from dlstats.fetchers import schemas
        from pymongo import ReadPreference
@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
def cmd_restore(**kwargs):
    """Restore database or collection(s)"""
    ctx = client.Context(**kwargs)
    ctx.log_error("Not Implemented")

#TODO: @cli.command('report', context_settings=client.DLSTATS_SETTINGS)
@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
def cmd_report(**kwargs):
    """Technical statistic report"""
    ctx = client.Context(**kwargs)
    ctx.log_error("Not Implemented")

#TODO: exclude/include col
#TODO: limit sample docs à un échantillon
@cli.command('check-schemas', context_settings=client.DLSTATS_SETTINGS)
@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
@click.option('--max-errors', '-M', default=0, type=int, show_default=True)
def cmd_check_schemas(max_errors=None, **kwargs):
    """Check datas in DB with schemas
    """

# Path: dlstats/constants.py
# CACHE_URL = os.environ.get('WIDUKIND_CACHE_URL', 'simple') #redis://localhost:6379/0
# SCHEMAS_VALIDATION_DISABLE = os.environ.get('WIDUKIND_SCHEMAS_VALIDATION_DISABLE', 'false')
# 
# Path: dlstats/client.py
# DLSTATS_SETTINGS = dict(auto_envvar_prefix='DLSTATS')
# DEFAULT_PATH_REQUESTS_CACHE = os.path.abspath(os.path.join(tempfile.gettempdir(), "dlstats"))
# class Context(object):
# class ComplexCLI(click.MultiCommand):
#     def __init__(self, mongo_url=None, verbose=False,
#                  log_level='ERROR', log_config=None, log_file=None,
#                  trace=False,
#                  cache_enable=False,  
#                  requests_cache_enable=None, requests_cache_path=None, 
#                  requests_cache_expire=None,               
#                  debug=False, silent=False, pretty=False, quiet=False):
#     def _set_log_file(self):
#     def _set_cache(self):
#     def _set_requests_cache(self):
#     def log(self, msg, *args):
#     def log_error(self, msg, *args):
#     def log_ok(self, msg, *args):
#     def log_warn(self, msg, *args):
#     def pretty_print(self, obj):
#     def mongo_client(self):
#     def lock(self, key, owner, timeout=None, expire=None):
#     def mongo_database(self):
#     def mongo_fs(self):
#     def list_commands(self, ctx):
#     def get_command(self, ctx, name):
# def cli():
# def main():
# 
# Path: dlstats/fetchers/schemas.py
# def date_validator(value):
# def typecheck(_type, msg=None):
#     def validator(value):


# Path: dlstats/commands/cmd_mongo.py
import time
import click
        import pymongo
from pprint import pprint
from widukind_common.utils import create_or_update_indexes
from widukind_common import tests_tools as utils
from dlstats import constants
from dlstats import client
from dlstats.fetchers import schemas
        from pymongo import ReadPreference

@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
def cmd_restore(**kwargs):
    """Restore database or collection(s)"""
    ctx = client.Context(**kwargs)
    ctx.log_error("Not Implemented")

#TODO: @cli.command('report', context_settings=client.DLSTATS_SETTINGS)
@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
def cmd_report(**kwargs):
    """Technical statistic report"""
    ctx = client.Context(**kwargs)
    ctx.log_error("Not Implemented")

#TODO: exclude/include col
#TODO: limit sample docs à un échantillon
@cli.command('check-schemas', context_settings=client.DLSTATS_SETTINGS)
@client.opt_verbose
@client.opt_silent
@client.opt_debug
@client.opt_mongo_url
@click.option('--max-errors', '-M', default=0, type=int, show_default=True)
def cmd_check_schemas(max_errors=None, **kwargs):
    """Check datas in DB with schemas
    """

    ctx = client.Context(**kwargs)