# Path: dlstats/version.py
# VERSION = (0, 8, 6)
# def version_str():
# 
# Path: dlstats/constants.py
# CACHE_URL = os.environ.get('WIDUKIND_CACHE_URL', 'simple') #redis://localhost:6379/0


import atexit
import tempfile
import pprint
import os
import sys
import contextlib
import gridfs
import click
            import requests_cache
from widukind_common.utils import get_mongo_url, get_mongo_client, configure_logging
from widukind_common.mongolock import MongoLock, MongoLockLocked
from widukind_common import errors
from dlstats import version
from dlstats.constants import CACHE_URL
            from widukind_common import debug
        from logging import FileHandler
        from dlstats import cache
        if not self.db_mongo:
            self.db_mongo = self.mongo_client().get_default_database()
        return self.db_mongo
    
    def mongo_fs(self):
        db = self.mongo_database()
        if not self.fs_mongo:
            self.fs_mongo = gridfs.GridFS(db)
        return self.fs_mongo

class ComplexCLI(click.MultiCommand):
    def list_commands(self, ctx):
        rv = []
        for filename in os.listdir(cmd_folder):
            if filename.endswith('.py') and \
               filename.startswith('cmd_'):
                rv.append(filename[4:-3])
        rv.sort()
        return rv

    def get_command(self, ctx, name):
        try:
            mod = __import__('dlstats.commands.cmd_' + name, None, None,
                             ['cli'])
        except ImportError:
            return
        return mod.cli


@click.command(cls=ComplexCLI)

# Path: dlstats/version.py
# VERSION = (0, 8, 6)
# def version_str():
# 
# Path: dlstats/constants.py
# CACHE_URL = os.environ.get('WIDUKIND_CACHE_URL', 'simple') #redis://localhost:6379/0


# Path: dlstats/client.py
import atexit
import tempfile
import pprint
import os
import sys
import contextlib
import gridfs
import click
            import requests_cache
from widukind_common.utils import get_mongo_url, get_mongo_client, configure_logging
from widukind_common.mongolock import MongoLock, MongoLockLocked
from widukind_common import errors
from dlstats import version
from dlstats.constants import CACHE_URL
            from widukind_common import debug
        from logging import FileHandler
        from dlstats import cache

        if not self.db_mongo:
            self.db_mongo = self.mongo_client().get_default_database()
        return self.db_mongo
    
    def mongo_fs(self):
        db = self.mongo_database()
        if not self.fs_mongo:
            self.fs_mongo = gridfs.GridFS(db)
        return self.fs_mongo

class ComplexCLI(click.MultiCommand):
    def list_commands(self, ctx):
        rv = []
        for filename in os.listdir(cmd_folder):
            if filename.endswith('.py') and \
               filename.startswith('cmd_'):
                rv.append(filename[4:-3])
        rv.sort()
        return rv

    def get_command(self, ctx, name):
        try:
            mod = __import__('dlstats.commands.cmd_' + name, None, None,
                             ['cli'])
        except ImportError:
            return
        return mod.cli


@click.command(cls=ComplexCLI)

@click.version_option(version=version.version_str(),