# Path: libeclectus/util.py
# def cachedproperty(fget):
#     def fget_wrapper(self):
#         try: return fget_wrapper._cached
#         except AttributeError:
#             fget_wrapper._cached = value = fget(self)
#             return value
#     def fdel(self):
#         try: del fget_wrapper._cached
#         except AttributeError: pass
#     return property(fget_wrapper, fdel=fdel, doc=fget.__doc__)
# 
# def getDatabaseConfiguration(databaseUrl=None):
#     configuration = {}
#     if databaseUrl:
#         configuration['sqlalchemy.url'] = databaseUrl
#         if databaseUrl.startswith('sqlite://'):
#             configuration['attach'] = ([getDatabaseUrl()]
#                 + getAttachableDatabases())
#     else:
#         configuration['sqlalchemy.url'] = getDatabaseUrl()
#         configuration['attach'] = getAttachableDatabases()
#     return configuration


import re
from sqlalchemy import select
from sqlalchemy.sql import and_, or_
from cjklib.dbconnector import getDBConnector
from cjklib.characterlookup import CharacterLookup
from cjklib import exception
from libeclectus.util import cachedproperty, getDatabaseConfiguration
                subCharCount = 3
            treeElements = []
            curIndex = idx
            while len(treeElements) < subCharCount:
                curIndex = curIndex + 1
                element = decomposition[curIndex]
                if type(element) != type(()):
                    # ids element -> sub decomposition on same layer,
                    #   break down into sub tree
                    curIndex, tree = splitFlatTree(None, decomposition,
                        curIndex)
                    treeElements.append(tree)
                else:
                    # proper character
                    subChar, zVariant, subDecomposition = element
                    if subDecomposition:
                        _, tree = splitFlatTree(subChar, subDecomposition[0])
                        treeElements.append(tree)
                    else:
                        treeElements.append(subChar)
            return curIndex, (layout, char, treeElements)

        treeList = self.getDecompositionTreeList(char)
        if not treeList:
            return None
        else:
            # TODO more sophisticated, get the "nicest" decomposition
            _, tree = splitFlatTree(char, treeList[0])
            return tree


# Path: libeclectus/util.py
# def cachedproperty(fget):
#     def fget_wrapper(self):
#         try: return fget_wrapper._cached
#         except AttributeError:
#             fget_wrapper._cached = value = fget(self)
#             return value
#     def fdel(self):
#         try: del fget_wrapper._cached
#         except AttributeError: pass
#     return property(fget_wrapper, fdel=fdel, doc=fget.__doc__)
# 
# def getDatabaseConfiguration(databaseUrl=None):
#     configuration = {}
#     if databaseUrl:
#         configuration['sqlalchemy.url'] = databaseUrl
#         if databaseUrl.startswith('sqlite://'):
#             configuration['attach'] = ([getDatabaseUrl()]
#                 + getAttachableDatabases())
#     else:
#         configuration['sqlalchemy.url'] = getDatabaseUrl()
#         configuration['attach'] = getAttachableDatabases()
#     return configuration


# Path: libeclectus/chardb.py
import re
from sqlalchemy import select
from sqlalchemy.sql import and_, or_
from cjklib.dbconnector import getDBConnector
from cjklib.characterlookup import CharacterLookup
from cjklib import exception
from libeclectus.util import cachedproperty, getDatabaseConfiguration

                subCharCount = 3
            treeElements = []
            curIndex = idx
            while len(treeElements) < subCharCount:
                curIndex = curIndex + 1
                element = decomposition[curIndex]
                if type(element) != type(()):
                    # ids element -> sub decomposition on same layer,
                    #   break down into sub tree
                    curIndex, tree = splitFlatTree(None, decomposition,
                        curIndex)
                    treeElements.append(tree)
                else:
                    # proper character
                    subChar, zVariant, subDecomposition = element
                    if subDecomposition:
                        _, tree = splitFlatTree(subChar, subDecomposition[0])
                        treeElements.append(tree)
                    else:
                        treeElements.append(subChar)
            return curIndex, (layout, char, treeElements)

        treeList = self.getDecompositionTreeList(char)
        if not treeList:
            return None
        else:
            # TODO more sophisticated, get the "nicest" decomposition
            _, tree = splitFlatTree(char, treeList[0])
            return tree


    @cachedproperty