# 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
        if match(r'[0-9\-]*$', self.chapter):
            chapter = ('c' +
                       '-'.join(x.zfill(3) for x in self.chapter.split('-')))
        # Individually numbered chapter with letter following the number
        # (e.g. '35v2', '9a').
        elif match(r'[0-9]*[A-Za-z][0-9]*?$', self.chapter):
            number = match(r'([0-9]*)[A-Za-z]', self.chapter).group(1)
            chapter = 'c{:0>3}'.format(number)
        # Individually numbered chapter with decimal (e.g. '1.5').
        elif match(r'[0-9]*\.[0-9]*$', self.chapter):
            number, decimal = self.chapter.split('.')
            chapter = 'c{:0>3} x{}'.format(number, decimal)
        # Failing all else, e.g. 'Special'. Becomes 'c000 [Special]'.
        else:
            chapter = 'c000 [{}]'.format(self.chapter)

        if self.groups:
            group = ''.join('[{}]'.format(g) for g in self.groups)
        else:
            group = '[Unknown]'

        if config.get().cbz:
            ext = 'cbz'
        else:
            ext = 'zip'

        if self.directory:
            directory = os.path.expanduser(self.directory)
        else:
            directory = name

# 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

        if match(r'[0-9\-]*$', self.chapter):
            chapter = ('c' +
                       '-'.join(x.zfill(3) for x in self.chapter.split('-')))
        # Individually numbered chapter with letter following the number
        # (e.g. '35v2', '9a').
        elif match(r'[0-9]*[A-Za-z][0-9]*?$', self.chapter):
            number = match(r'([0-9]*)[A-Za-z]', self.chapter).group(1)
            chapter = 'c{:0>3}'.format(number)
        # Individually numbered chapter with decimal (e.g. '1.5').
        elif match(r'[0-9]*\.[0-9]*$', self.chapter):
            number, decimal = self.chapter.split('.')
            chapter = 'c{:0>3} x{}'.format(number, decimal)
        # Failing all else, e.g. 'Special'. Becomes 'c000 [Special]'.
        else:
            chapter = 'c000 [{}]'.format(self.chapter)

        if self.groups:
            group = ''.join('[{}]'.format(g) for g in self.groups)
        else:
            group = '[Unknown]'

        if config.get().cbz:
            ext = 'cbz'
        else:
            ext = 'zip'

        if self.directory:
            directory = os.path.expanduser(self.directory)
        else:
            directory = name

        download_dir = os.path.expanduser(config.get().download_directory)