Table of Contents

Module: components ./src/peak/binding/components.py

Basic binding tools

Imported modules   
from __future__ import generators
from _once import BaseDescriptor
from attributes import *
from interfaces import *
from once import *, _warnIfPermission
from peak.api import *
from peak.config.interfaces import IConfigKey, IConfigurationRoot, NullConfigRoot, IConfigurable
from peak.config.registries import ImmutableConfig
from peak.naming.names import toName, AbstractName, COMPOUND_KIND, IName
from peak.naming.syntax import PathSyntax
from peak.util.EigenData import AlreadyRead
from peak.util.decorators import decorate
from peak.util.imports import importString, whenImported
from types import ModuleType
Functions   
_setupCriterion
_setupParse
acquireComponent
getComponentName
getComponentPath
getParentComponent
getRootComponent
get_name_of_ActiveClass
get_name_of_module
get_name_of_node
get_name_of_object
get_parent_of_ActiveClass
get_parent_of_module
get_parent_of_node
get_parent_of_object
hasParent
iterParents
lookupComponent
notifyUponAssembly
  _setupCriterion 
_setupCriterion ( strategy )

  _setupParse 
_setupParse ( predicates )

  acquireComponent 
acquireComponent (
        component,
        name,
        default=NOT_GIVEN,
        )

Acquire name relative to component, w/fallback to naming.lookup()

name is looked for as an attribute of component. If not found, the component's parent will be searched, and so on until the root component is reached. If name is still not found, and the root component implements config.IConfigurationRoot, the name will be looked up in the default naming context, if any. Otherwise, a NameNotFound error will be raised.

  getComponentName 
getComponentName ( component )

Return name of component, or None if root or non-component

This also works for module objects, and binding.ActiveClass objects, for which the module or class' __name__ is returned.

This is a generic function, so you can add cases for additional object types using binding.getComponentName.when() as a decorator.

  getComponentPath 
getComponentPath ( component,  relativeTo=None )

Get ComponentName that would traverse from relativeTo to component

If relativeTo is None or not supplied, the path returned is relative to the root component of component. Note that if supplied, relativeTo must be an ancestor (parent, parent's parent, etc.) of component.

  getParentComponent 
getParentComponent ( component )

Return parent of component, or None if unknown or non-component

This also works for module objects, and binding.ActiveClass objects, for which the containing module or package is returned.

This is a generic function, so you can add cases for additional object types using binding.getParentComponent.when() as a decorator.

  getRootComponent 
getRootComponent ( component )

Return the root component of the tree component belongs to

  get_name_of_ActiveClass 
get_name_of_ActiveClass ( component )

  get_name_of_module 
get_name_of_module ( component )

  get_name_of_node 
get_name_of_node ( component )

  get_name_of_object 
get_name_of_object ( component )

  get_parent_of_ActiveClass 
get_parent_of_ActiveClass ( component )

  get_parent_of_module 
get_parent_of_module ( component )

  get_parent_of_node 
get_parent_of_node ( component )

  get_parent_of_object 
get_parent_of_object ( component )

  hasParent 
hasParent ( component,  parent )

Is component within the hierarchy of parent?

  iterParents 
iterParents ( component,  max_depth=100 )

Iterate over all parents of component, up to max_depth

Exceptions   
RuntimeError( "maximum recursion limit exceeded", component )
  lookupComponent 
lookupComponent (
        component,
        name,
        default=NOT_GIVEN,
        adaptTo=None,
        creationName=None,
        suggestParent=True,
        )

Lookup name as a component key relative to component

name can be any object that implements or is adaptable to IComponentKey. Such objects include peak.naming names, interface objects, property names, and any custom objects you may create that implement IComponentKey. Strings will be converted to a URL, or to a ComponentName if they have no URL prefix. If the key cannot be found, an exceptions.NameNotFound error will be raised unless a default other than NOT_GIVEN is provided.

  notifyUponAssembly 
notifyUponAssembly ( parent,  child )

Call child.uponAssembly() as soon as parent knows all its parents

Classes   

Component

Thing that can be composed into a component tree, w/binding & lookups

ComponentName

Path between components

ConfigFinder

Look up utilities or properties

Configurable

Delegate

Delegate attribute to the same attribute of another object

Obtain

Obtain(componentKey,[default=value])' - finds/caches a needed component

PluginKeys

Component key that finds the keys of plugins matching a given key

PluginsFor

Component key that finds plugins matching a configuration key

Require

Placeholder for a binding that should be (re)defined by a subclass

SequenceFinder

Look up sequences of component keys

_Base

Basic attribute management and "active class" support

_proxy


Table of Contents

This document was automatically generated on Mon Apr 22 01:11:03 2024 by HappyDoc version 2.1