# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):
# 
# Path: cum/db.py
# class Series(Base):
# class Chapter(Base):
# class Group(Base):
#     def __init__(self, series):
#     def alias_lookup(alias, unfollowed=False):
#     def check_alias_uniqueness(self):
#     def last_added(self):
#     def mark_as_updated(self):
#     def needs_update(self):
#     def ordered_chapters(self):
#     def release_interval(self):
#     def __init__(self, chapter, series):
#     def find_new(alias=None):
#     def group_tag(self):
#     def status(self):
#     def to_object(self):
#     def __init__(self, name):
#     def __str__(self):
# def backup_database():
# def initialize():
# def test_database():
# 
# Path: cum/output.py
# def chapter(msg):
# def configuration(dictionary):
# def configuration_error(config_error):
# def configuration_flatten(dictionary, parent_key=None):
# def error(msg):
# def even_columns(items, bold_first_column=False, separator_width=1):
# def list(items):
# def series(msg):
# def warning(msg):


from abc import ABCMeta, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from cum import config, db, output
from mimetypes import guess_extension
from re import match, sub
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
from tempfile import NamedTemporaryFile
import click
import os
import requests
import sys
import zipfile
        self.url = url
        self.directory = kwargs.get('directory', None)

    @property
    def alias(self):
        """Returns an alias version of the series name, which only allows a
        certain command-line friendly set of characters.
        """
        allowed_re = r'[A-Za-z0-9\-\s]'

        # Take the series name, lowercase it, replace all spaces with dashes
        # and then replaces all repeating dashes with a single dash.
        name = sub('-+', '-', self.name.lower().replace(' ', '-'))

        # Return the string where all characters are matched to allowed_re.
        return ''.join(c for c in name if match(allowed_re, c))

    def follow(self, ignore=False):
        """Adds the series details to database and all current chapters."""

        try:
            s = db.session.query(db.Series).filter_by(url=self.url).one()
        except NoResultFound:
            s = db.Series(self)
            s.check_alias_uniqueness()
            output.series('Adding follow for {s.name} ({s.alias})'.format(s=s))
            db.session.add(s)
            db.session.commit()
        else:
            if s.following:

# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):
# 
# Path: cum/db.py
# class Series(Base):
# class Chapter(Base):
# class Group(Base):
#     def __init__(self, series):
#     def alias_lookup(alias, unfollowed=False):
#     def check_alias_uniqueness(self):
#     def last_added(self):
#     def mark_as_updated(self):
#     def needs_update(self):
#     def ordered_chapters(self):
#     def release_interval(self):
#     def __init__(self, chapter, series):
#     def find_new(alias=None):
#     def group_tag(self):
#     def status(self):
#     def to_object(self):
#     def __init__(self, name):
#     def __str__(self):
# def backup_database():
# def initialize():
# def test_database():
# 
# Path: cum/output.py
# def chapter(msg):
# def configuration(dictionary):
# def configuration_error(config_error):
# def configuration_flatten(dictionary, parent_key=None):
# def error(msg):
# def even_columns(items, bold_first_column=False, separator_width=1):
# def list(items):
# def series(msg):
# def warning(msg):


# Path: cum/scrapers/base.py
from abc import ABCMeta, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from cum import config, db, output
from mimetypes import guess_extension
from re import match, sub
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
from tempfile import NamedTemporaryFile
import click
import os
import requests
import sys
import zipfile

        self.url = url
        self.directory = kwargs.get('directory', None)

    @property
    def alias(self):
        """Returns an alias version of the series name, which only allows a
        certain command-line friendly set of characters.
        """
        allowed_re = r'[A-Za-z0-9\-\s]'

        # Take the series name, lowercase it, replace all spaces with dashes
        # and then replaces all repeating dashes with a single dash.
        name = sub('-+', '-', self.name.lower().replace(' ', '-'))

        # Return the string where all characters are matched to allowed_re.
        return ''.join(c for c in name if match(allowed_re, c))

    def follow(self, ignore=False):
        """Adds the series details to database and all current chapters."""

        try:
            s = db.session.query(db.Series).filter_by(url=self.url).one()
        except NoResultFound:
            s = db.Series(self)
            s.check_alias_uniqueness()
            output.series('Adding follow for {s.name} ({s.alias})'.format(s=s))
            db.session.add(s)
            db.session.commit()
        else:
            if s.following:

                output.warning('You are already following {s.name} ({s.alias})'