Esempio n. 1
0
from builder.containers.episode import Episode
from builder.containers.material import Material
from builder.containers.scene import Scene
from builder.containers.story import Story
from builder.core.executer import Executer
from builder.datatypes.builderexception import BuilderError
from builder.datatypes.resultdata import ResultData
from builder.datatypes.storyconfig import StoryConfig
from builder.utils import assertion
from builder.utils.logger import MyLogger

# alias
ContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)

# logger
LOG = MyLogger.get_logger(__name__)
LOG.set_file_handler()


class Reducer(Executer):
    ''' Reducer Executer class.
    '''
    def __init__(self):
        super().__init__()
        LOG.info('REDUCER: initialize')

    #
    # methods
    #

    def execute(self, src: Story, config: StoryConfig) -> ResultData:
__VERSION__ = f"{MAJOR}.{MINOR}.{MICRO}-{FEATURE}" if int(FEATURE) else f"{MAJOR}.{MINOR}.{MICRO}"
__AUTHOR__ = __maintainer__ = 'N.T.Works'
__EMAIL__ = '*****@*****.**'
__DESC__ = 'Story builder is a library for developing story contents.'


#
# CONSTANTS
#

__DEFAULT_LOG_LEVEL__ = 'warning'
__PRIORITY_DEFAULT__ = 5
__PRIORITY_MAX__ = 10
__PRIORITY_MIN__ = 0

VERSION_MSG = (
        'StoryBuilder: version: v{0}'.format(__VERSION__),
        'Python: version: {0}'.format(' '.join(line.strip() for line in sys.version.splitlines())),
        )

#
# LOGGER
#
import datetime
from builder.utils.logger import MyLogger

LOG = MyLogger.get_logger(__TITLE__)
LOG.set_file_handler(f'{datetime.date.today()}')
LOG.set_shared_level(__DEFAULT_LOG_LEVEL__)