Are there reserved method names within pyre, and how can I find out what they are?
From DANSE
There are many reserved methods within pyre. The easiest way to find out what they are is to create a simple class within the python interpreter, and then examine the class instance with the 'dir' command.
A regular (non-pyre) python class inherits very few methods:
>$ python >>> class Bar: ... def __init__(self): ... return ... >>> simple = Bar() >>> dir(simple) ['__doc__', '__init__', '__module__']
A pyre Component has a number of pre-defined (reserved) methods that are generated when the component is instantiated:
>>> from pyre.components.Component import Component >>> class Baz(Component): ... def __init__(self): ... Component.__init__(self, name='baz', facility='baz') ... return ... >>> component = Baz() >>> dir(component) ['Inventory', '__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_claim', '_configure', '_debug', '_defaults', '_fini', '_info', '_init', 'aliases', 'applyConfiguration', 'components', 'configureComponent', 'configureComponents', 'configureProperties', 'createInventory', 'createRegistry', 'facilities', 'facility', 'fini', 'getCurator', 'getDepositories', 'getLocator', 'getTraitDescriptor', 'getTraitValue', 'init', 'initializeConfiguration', 'inventory', 'loadConfiguration', 'locator', 'name', 'properties', 'retrieveComponent', 'retrieveConfiguration', 'setCurator', 'setLocator', 'showComponents', 'showCurator', 'showProperties', 'showUsage', 'updateConfiguration']
A pyre Script has a similar, but larger set of methods:
>>> from pyre.applications.Script import Script >>> class Foo(Script): ... def __init__(self): ... Script.__init__(self, name='foo') ... return ... >>> script = Foo() >>> dir(script) ['Inventory', '__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_claim', '_configure', '_debug', '_defaults', '_fini', '_getPrivateDepositoryLocations', '_info', '_init', 'aliases', 'applyConfiguration', 'argv', 'collectUserInput', 'components', 'configureComponent', 'configureComponents', 'configureProperties', 'createCommandlineParser', 'createCurator', 'createInventory', 'createRegistry', 'execute', 'facilities', 'facility', 'filename', 'fini', 'generateBanner', 'getCurator', 'getDepositories', 'getLocator', 'getTraitDescriptor', 'getTraitValue', 'help', 'init', 'initializeConfiguration', 'initializeCurator', 'inventory', 'loadConfiguration', 'locator', 'main', 'name', 'processCommandline', 'properties', 'pruneRegistry', 'registry', 'retrieveComponent', 'retrieveConfiguration', 'run', 'setCurator', 'setLocator', 'showComponents', 'showCurator', 'showProperties', 'showUsage', 'updateConfiguration', 'usage', 'verifyConfiguration', 'weaver']
To explore any of these methods, an easy approach is to try python's 'help' method. This will provide a brief doc string for many of pyre's reserved methods.
>>> help(component.properties)
Help on method properties:
properties(self) method of __main__.Baz instance
return a list of all the property objects in my inventory
(END)
>>> help(component._defaults)
Help on method _defaults:
_defaults(self) method of __main__.Baz instance
modify the default inventory values
(END)
The most commonly used pyre methods are described in greater detail elsewhere (for instance, on this wiki). --McKerns 14:29, 11 Apr 2005 (PDT)
