コード例 #1
0
ファイル: mathobjects.py プロジェクト: sdiehl/wise
def build_pure_lookup(force=False):
    if pure_trans.loaded and not force:
        return

    for name in settings.INSTALLED_MATH_PACKAGES:
        pack_module = load_package(name)
        package = wise.meta_inspector.PACKAGES[name]

        if module_has_submodule(pack_module, 'objects'):
            print 'Building Pure translation table from ... ' + name

            pack_objects = load_package_module(name,'objects')
            super_clss, nullary_types = pack_objects.initialize()

            # Populate the Pure translation table with nullary
            # objects
            pure_trans.populate(nullary_types)

    _pure_trans = {}
    for cls in python_trans.table.values():
        if hasattr(cls,'pure'):
            _pure_trans[cls.pure] = cls

    pure_trans.populate(_pure_trans)

    return pure_trans
コード例 #2
0
ファイル: mathobjects.py プロジェクト: sdiehl/wise
def build_python_lookup(force=False):
    if python_trans.loaded and not force:
        return

    for name in settings.INSTALLED_MATH_PACKAGES:
        pack_module = load_package(name)
        package = wise.meta_inspector.PACKAGES[name]

        if module_has_submodule(pack_module, 'objects'):
            print 'Building Python translation table from ... ' + name

            pack_objects = load_package_module(name,'objects')
            super_clss, nullary_types = pack_objects.initialize()

            first_order_symbols, all_symbols = collect_objects(name, recursive=True)
            python_trans.populate(first_order_symbols)
            python_trans.populate(all_symbols)

            # Give the package a list of strings containing the
            # classnames of the provided symbols and update the
            # persistence in memory value and sync to the disk
            if not package.provided_symbols:
                wise.meta_inspector.PACKAGES.make_writable()

                for sym in first_order_symbols.iterkeys():
                    package.provides(sym)

                wise.meta_inspector.PACKAGES[name] = package
                wise.meta_inspector.PACKAGES.sync()
            else:
                if settings.DEBUG:
                    pass
                    #print 'Not rebuilding symbol table for:', name

    return python_trans
コード例 #3
0
ファイル: panel.py プロジェクト: sdiehl/wise
def build_panels(force=False):
    if panels and not settings.NOCACHE:
        print 'Using cached panels file.'
        return

    for pack_name in settings.INSTALLED_MATH_PACKAGES:
        print 'Importing panels from ... ' + pack_name
        pack_module = loader.load_package(pack_name)

        # Load PACKAGE/panel.py
        if module_has_submodule(pack_module, 'panel'):
            pack_panels = loader.load_package_module(pack_name,'panel')

            panels.make_writable()
            for panel_name, symbol in pack_panels.__dict__.iteritems():
                if is_panel(symbol):
                    symbol.package = pack_name
                    panels[panel_name] = symbol

            panels.sync()