# 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
        @returns: minimal character components
        @todo Impl: Implement a locale/character domain based set of minimal
            components instead of all Kangxi radical forms.
        """
        table = self.db.tables['KangxiRadicalStrokeCount']
        strokeCountDict = dict(self.db.selectRows(select(
            [table.c.RadicalIndex, table.c.StrokeCount])))

        minimalCharacterComponents = {}

        for radicalIdx in range(1, 215):
            mainForm = self.getKangxiRadicalForm(radicalIdx)

            variants = self.getKangxiRadicalVariantForms(radicalIdx)

            if self.locale != 'T':
                radicalLocaleForm = mainForm
                mainForm = self._characterLookupTraditional\
                    .getKangxiRadicalForm(radicalIdx)
                if mainForm != radicalLocaleForm:
                    variants.insert(0, radicalLocaleForm)
            strokeCount = strokeCountDict[radicalIdx]

            if strokeCount not in minimalCharacterComponents:
                minimalCharacterComponents[strokeCount] = set()
            minimalCharacterComponents[strokeCount].add(mainForm)
            minimalCharacterComponents[strokeCount].update(variants)

        return minimalCharacterComponents


# 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

        @returns: minimal character components
        @todo Impl: Implement a locale/character domain based set of minimal
            components instead of all Kangxi radical forms.
        """
        table = self.db.tables['KangxiRadicalStrokeCount']
        strokeCountDict = dict(self.db.selectRows(select(
            [table.c.RadicalIndex, table.c.StrokeCount])))

        minimalCharacterComponents = {}

        for radicalIdx in range(1, 215):
            mainForm = self.getKangxiRadicalForm(radicalIdx)

            variants = self.getKangxiRadicalVariantForms(radicalIdx)

            if self.locale != 'T':
                radicalLocaleForm = mainForm
                mainForm = self._characterLookupTraditional\
                    .getKangxiRadicalForm(radicalIdx)
                if mainForm != radicalLocaleForm:
                    variants.insert(0, radicalLocaleForm)
            strokeCount = strokeCountDict[radicalIdx]

            if strokeCount not in minimalCharacterComponents:
                minimalCharacterComponents[strokeCount] = set()
            minimalCharacterComponents[strokeCount].add(mainForm)
            minimalCharacterComponents[strokeCount].update(variants)

        return minimalCharacterComponents


    @cachedproperty