Table of Contents

Module: core ./src/peak/core.py

PEAK's Core API

This module provides easy access to PEAK's core API's and modules.

For each of the binding, config, model, and naming packages, this module exports that package's api module under the corresponding name, using a lazy import. Thus from peak.core import binding will give you a lazily imported version of the peak.binding.api module. This allows you to get quick, easy access to the PEAK core API, without complex import patterns, but also without a lot of namespace pollution.

In addition to the lazily-imported modules, peak.core also exports the following objects for convenience in interacting with PEAK's APIs:

NOT_GIVEN and NOT_FOUND
Singleton values used for convenience in dealing with non-existent parameters or dictionary/cache entries
Items()
a convenience function that produces a 'dict.items()'-style list from a mapping and/or keyword arguments.
PropertyName
a string subclass with restricted syntax, that's useful for creating configuration keys. Using property names as configuration keys makes it easy to create hierarchical configuration namespaces and define them in .ini files (similar to peak.ini).
adapt()
the PEP 246 adapt() function.
protocols
the PyProtocols protocols package.
dispatch
the PyProtocols dispatch package.

Imported modules   
from __future__ import generators
import dispatch
from peak.util.imports import lazyModule, whenImported
from peak.util.symbols import NOT_GIVEN, NOT_FOUND
import protocols
from protocols import adapt
import re
Functions   
Items
  Items 
Items ( mapping=None,  **kwargs )

Convert mapping and/or kwargs into a list of (key,val) items

Key/value item lists are often easier or more efficient to manipulate than mapping objects, so PEAK API's will often use such lists as a preferred parameter format. Sometimes, however, the syntactic sugar of keyword items, possibly in combination with an existing mapping object, is desired. In those cases, the Items() function can be used .

Items() takes an optional mapping and optional keyword arguments, and returns a key/value pair list that contains the items from both the mapping and keyword arguments, with the keyword arguments taking precedence over (i.e. being later in the list than) the mapping items.

Classes   

PropertyName

Name of a configuration property, usable as a configuration key


Table of Contents

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