# Path: legacy_codes/app/myLogger.py
# def viewLog(mode, data=None):
#     """
#     전달된 mode에 따라 로깅 내용이 달라진다.
#     message : 유저키, 타입, 내용을 기록한다. json형태의 data
#     add : 유저키를 기록한다. json형태의 data
#     block, exit : 유저키를 기록한다. string형태의 data
#     fail : 기본 request 처리 실패 로그
#     """
#     if mode is "message":
#         app.logger.info("[message] user_key : {}, type : {}, content : {}".format(
#             data["user_key"],
#             data["type"],
#             data["content"]))
#     elif mode is "scheduler":
#         app.logger.info("[parsing] data: {}".format(data))
#     elif mode is "query":
#         app.logger.info("[query] hakusiku {}".format(data))
#     elif mode is "review":
#         app.logger.info("[review] user_key: {}, review: {}".format(
#             data['user_key'],
#             data['content'],
#         ))
#     elif mode is "keyboard":
#         app.logger.info("[keyboard] call home keyboard")
#     elif mode is "add":
#         app.logger.info("[join] user_key : {}".format(data["user_key"]))
#     elif mode is "block":
#         app.logger.info("[block] user_key : {}".format(data))
#     elif mode is "exit":
#         app.logger.info("[exit] user_key : {}".format(data))
#     elif mode is "fail":
#         app.logger.info("[fail] request process fail log: {}".format(data))
# 
# Path: legacy_codes/app/parser.py
# class Singleton(type):
# class FoodParser:
# class SubwayParser(metaclass=Singleton):
# class BusParser(metaclass=Singleton):
# class LibParser(metaclass=Singleton):
#     def __call__(cls, *args, **kwargs):
#     def __init__(self):
#     def refresh(self, date=None):
#     def get_food(self, place):
#     def __init__(self):
#     def get_station_stat(self, station_name):
#     def __init__(self):
#     def get_station_stat(self, station_number):
#     def __init__(self):
#     def get_lib_stat(self):


import datetime
from .myLogger import viewLog
from .parser import food_api
            from .managers import DBAdmin
        from .managers import DBAdmin
                from .my_exception import FoodNotFound
            from .managers import DBAdmin
            from .managers import DBAdmin
            from .my_exception import FoodNotFound
            viewLog('scheduler', food_dict)
            DBAdmin.set_hakusiku_data(food_dict, date)

        except Exception as e:
            viewLog("fail", e)

    def prepare_food(self, date=None):
        """
        draft of set_food func using hakusiku db
        :return: None
        """
        data = DBAdmin.get_hakusiku_data(date)
        if data:
            self.foods = data[self.kor_name]
            viewLog("query", self.foods)

        else:
            try:
                self.fetch_save_menu(date)
                data = DBAdmin.get_hakusiku_data(date)
                self.foods = data[self.kor_name]
            except Exception as e:
                raise FoodNotFound(e)

    def scheduled_refresh_food(self):
        """
        주기적으로 하는 메뉴 업데이트
        :return:
        """
        try:

# Path: legacy_codes/app/myLogger.py
# def viewLog(mode, data=None):
#     """
#     전달된 mode에 따라 로깅 내용이 달라진다.
#     message : 유저키, 타입, 내용을 기록한다. json형태의 data
#     add : 유저키를 기록한다. json형태의 data
#     block, exit : 유저키를 기록한다. string형태의 data
#     fail : 기본 request 처리 실패 로그
#     """
#     if mode is "message":
#         app.logger.info("[message] user_key : {}, type : {}, content : {}".format(
#             data["user_key"],
#             data["type"],
#             data["content"]))
#     elif mode is "scheduler":
#         app.logger.info("[parsing] data: {}".format(data))
#     elif mode is "query":
#         app.logger.info("[query] hakusiku {}".format(data))
#     elif mode is "review":
#         app.logger.info("[review] user_key: {}, review: {}".format(
#             data['user_key'],
#             data['content'],
#         ))
#     elif mode is "keyboard":
#         app.logger.info("[keyboard] call home keyboard")
#     elif mode is "add":
#         app.logger.info("[join] user_key : {}".format(data["user_key"]))
#     elif mode is "block":
#         app.logger.info("[block] user_key : {}".format(data))
#     elif mode is "exit":
#         app.logger.info("[exit] user_key : {}".format(data))
#     elif mode is "fail":
#         app.logger.info("[fail] request process fail log: {}".format(data))
# 
# Path: legacy_codes/app/parser.py
# class Singleton(type):
# class FoodParser:
# class SubwayParser(metaclass=Singleton):
# class BusParser(metaclass=Singleton):
# class LibParser(metaclass=Singleton):
#     def __call__(cls, *args, **kwargs):
#     def __init__(self):
#     def refresh(self, date=None):
#     def get_food(self, place):
#     def __init__(self):
#     def get_station_stat(self, station_name):
#     def __init__(self):
#     def get_station_stat(self, station_number):
#     def __init__(self):
#     def get_lib_stat(self):


# Path: legacy_codes/app/menu.py
import datetime
from .myLogger import viewLog
from .parser import food_api
            from .managers import DBAdmin
        from .managers import DBAdmin
                from .my_exception import FoodNotFound
            from .managers import DBAdmin
            from .managers import DBAdmin
            from .my_exception import FoodNotFound

            viewLog('scheduler', food_dict)
            DBAdmin.set_hakusiku_data(food_dict, date)

        except Exception as e:
            viewLog("fail", e)

    def prepare_food(self, date=None):
        """
        draft of set_food func using hakusiku db
        :return: None
        """
        data = DBAdmin.get_hakusiku_data(date)
        if data:
            self.foods = data[self.kor_name]
            viewLog("query", self.foods)

        else:
            try:
                self.fetch_save_menu(date)
                data = DBAdmin.get_hakusiku_data(date)
                self.foods = data[self.kor_name]
            except Exception as e:
                raise FoodNotFound(e)

    def scheduled_refresh_food(self):
        """
        주기적으로 하는 메뉴 업데이트
        :return:
        """
        try:

            food_api.refresh(None)