# Path: framework/knowledge/feedback_collector.py
# class FeedbackSource(object):
# 
#     def __init__(self, src, subref=None, reliability=None, related_tg=None):
#         self._subref = subref
#         self._name = str(src) if subref is None else str(src) + ' - ' + str(subref)
#         self._obj = src
#         self._reliability = reliability
#         self._related_tg = related_tg
# 
#     def __str__(self):
#         return self._name
# 
#     def __hash__(self):
#         return id(self._obj)
# 
#     def __eq__(self, other):
#         return id(self._obj) == id(other._obj)
# 
#     @property
#     def obj(self):
#         return self._obj
# 
#     @property
#     def related_tg(self):
#         return self._related_tg
# 
# Path: libs/utils.py
# def ensure_dir(f):
#     d = os.path.dirname(f)
#     if not os.path.exists(d):
#         os.makedirs(d)
# 
# def chunk_lines(string, length):
#     l = string.split(' ')
#     chk_list = []
#     full_line = ''
#     for wd in l:
#         full_line += wd + ' '
#         if len(full_line) > (length - 1):
#             chk_list.append(full_line)
#             full_line = ''
#     if full_line:
#         chk_list.append(full_line)
#     # remove last space char
#     if chk_list:
#         chk_list[-1] = (chk_list[-1])[:-1]
#     return chk_list


import sys
import os
import re
import math
import threading
import framework.global_resources as gr
import libs.external_modules as em
from datetime import datetime
from framework.knowledge.feedback_collector import FeedbackSource
from libs.external_modules import *
from libs.utils import ensure_dir, chunk_lines
                msg += colorize(",\n".format(src) + ' '*len(status_prefix), rgb=Color.FMKINFO)

        msg += '\n'
        sentd = sent_date.strftime("%d/%m/%Y - %H:%M:%S.%f") if sent_date else 'None'
        ackd = ack_date.strftime("%d/%m/%Y - %H:%M:%S.%f") if ack_date else 'None'
        msg += colorize("      Sent: ", rgb=Color.FMKINFO) + colorize(sentd, rgb=Color.DATE)
        msg += colorize("\n  Received: ", rgb=Color.FMKINFO) + colorize(ackd, rgb=Color.DATE)
        msg += colorize("\n      Size: ", rgb=Color.FMKINFO) + colorize(str(size) + ' Bytes',
                                                                        rgb=Color.FMKSUBINFO)
        msg += colorize('\n' + line_pattern, rgb=Color.NEWLOGENTRY)

        prt(msg)


        def handle_dmaker(dmk_pattern, info, dmk_type, dmk_name, name_sep_sz, ui, id_src=None):
            msg = ''
            msg += colorize("\n  |_ {:s}: ".format(dmk_pattern), rgb=Color.FMKINFO)
            msg += colorize(str(dmk_type).ljust(name_sep_sz, ' '), rgb=Color.FMKSUBINFO)
            if id_src is None:
                msg += colorize(" | Name: ", rgb=Color.FMKINFO)
                msg += colorize(str(dmk_name), rgb=Color.FMKSUBINFO)
                msg += colorize("  | UI: ", rgb=Color.FMKINFO)
                msg += colorize(str(ui), rgb=Color.FMKSUBINFO)
            else:
                msg += colorize("  | ID source: ", rgb=Color.FMKINFO)
                msg += colorize(str(id_src), rgb=Color.FMKSUBINFO)
            if info is not None:
                info = gr.unconvert_from_internal_repr(info)
                info = info.split('\n')
                for i in info:

# Path: framework/knowledge/feedback_collector.py
# class FeedbackSource(object):
# 
#     def __init__(self, src, subref=None, reliability=None, related_tg=None):
#         self._subref = subref
#         self._name = str(src) if subref is None else str(src) + ' - ' + str(subref)
#         self._obj = src
#         self._reliability = reliability
#         self._related_tg = related_tg
# 
#     def __str__(self):
#         return self._name
# 
#     def __hash__(self):
#         return id(self._obj)
# 
#     def __eq__(self, other):
#         return id(self._obj) == id(other._obj)
# 
#     @property
#     def obj(self):
#         return self._obj
# 
#     @property
#     def related_tg(self):
#         return self._related_tg
# 
# Path: libs/utils.py
# def ensure_dir(f):
#     d = os.path.dirname(f)
#     if not os.path.exists(d):
#         os.makedirs(d)
# 
# def chunk_lines(string, length):
#     l = string.split(' ')
#     chk_list = []
#     full_line = ''
#     for wd in l:
#         full_line += wd + ' '
#         if len(full_line) > (length - 1):
#             chk_list.append(full_line)
#             full_line = ''
#     if full_line:
#         chk_list.append(full_line)
#     # remove last space char
#     if chk_list:
#         chk_list[-1] = (chk_list[-1])[:-1]
#     return chk_list


# Path: framework/database.py
import sys
import os
import re
import math
import threading
import framework.global_resources as gr
import libs.external_modules as em
from datetime import datetime
from framework.knowledge.feedback_collector import FeedbackSource
from libs.external_modules import *
from libs.utils import ensure_dir, chunk_lines

                msg += colorize(",\n".format(src) + ' '*len(status_prefix), rgb=Color.FMKINFO)

        msg += '\n'
        sentd = sent_date.strftime("%d/%m/%Y - %H:%M:%S.%f") if sent_date else 'None'
        ackd = ack_date.strftime("%d/%m/%Y - %H:%M:%S.%f") if ack_date else 'None'
        msg += colorize("      Sent: ", rgb=Color.FMKINFO) + colorize(sentd, rgb=Color.DATE)
        msg += colorize("\n  Received: ", rgb=Color.FMKINFO) + colorize(ackd, rgb=Color.DATE)
        msg += colorize("\n      Size: ", rgb=Color.FMKINFO) + colorize(str(size) + ' Bytes',
                                                                        rgb=Color.FMKSUBINFO)
        msg += colorize('\n' + line_pattern, rgb=Color.NEWLOGENTRY)

        prt(msg)


        def handle_dmaker(dmk_pattern, info, dmk_type, dmk_name, name_sep_sz, ui, id_src=None):
            msg = ''
            msg += colorize("\n  |_ {:s}: ".format(dmk_pattern), rgb=Color.FMKINFO)
            msg += colorize(str(dmk_type).ljust(name_sep_sz, ' '), rgb=Color.FMKSUBINFO)
            if id_src is None:
                msg += colorize(" | Name: ", rgb=Color.FMKINFO)
                msg += colorize(str(dmk_name), rgb=Color.FMKSUBINFO)
                msg += colorize("  | UI: ", rgb=Color.FMKINFO)
                msg += colorize(str(ui), rgb=Color.FMKSUBINFO)
            else:
                msg += colorize("  | ID source: ", rgb=Color.FMKINFO)
                msg += colorize(str(id_src), rgb=Color.FMKSUBINFO)
            if info is not None:
                info = gr.unconvert_from_internal_repr(info)
                info = info.split('\n')
                for i in info:

                    chks = chunk_lines(i, page_width - prefix_sz - 10)