def collectPropertyDefaults(self, registry=None): """place my default values in the given registry""" from Facility import Facility from pyre.inventory.odb.Registry import Registry import pyre.parsing.locators if registry is None: registry = Registry(self._priv_name) locator = pyre.parsing.locators.default() for prop in self._traitRegistry.itervalues(): # We intentionally don't call _getDefaultValue() -- at # this stage, we don't want anything to happen (files to # be opened, components to be instantiated, ...) try: # Pick up any values set by _defaults() methods. value = self._getTraitValue(prop.name) except KeyError: value = prop.default # The 'isinstance' is a limitation of the framework: e.g., # files and dimensionals to not stringify cleanly. # Fortunately, we are only interested in string defaults # at present (for macro expansion). if isinstance(value, basestring): registry.setProperty(prop.name, value, locator) return registry
def __init__(self, document, attributes): AbstractNode.__init__(self, document) name = attributes["name"] from pyre.inventory.odb.Registry import Registry self.component = Registry(name) return
def _decode(self, shelf): root = Registry("root") parser = Parser(root) parser.parseFile(shelf.name) shelf['inventory'] = root shelf._frozen = True return
def _decode(self, shelf): root = Registry("root") td, fn = split(shelf.name) if not td: td = "." basename = splitext(fn)[0] macros = {'td': td, 'basename': basename} parser = Parser(root, macros=macros) parser.read(shelf.name) shelf['inventory'] = root shelf._frozen = True return
def _decode(self, shelf): root = Registry("root") td, fn = split(shelf.name) if not td: td = "." basename = splitext(fn)[0] macros = { 'td': td, 'basename': basename } parser = Parser(root, macros=macros) try: parser.read(shelf.name) except (AttributeError, KeyError) as err: raise AttributeError("Error parsing '{fp.name}' line {fp.lineno}".format(fp=parser._sections.fp)) shelf['inventory'] = root shelf._frozen = True return
def __init__(self, name): Component.__init__(self, "macros", name) self.macros = Registry(self.name) self.rp = None return