HappyDoc Generated Documentation unidist/dotinspect.py

unidist / dotinspect.py 

dotinspect

by Geoff Howland

dotinspect is a method of working with containers (dicts and sequences).

Format: "var1.-1.(var2a.var2b).var3"

Explanation: Each dot represents an inspection of the current data. The first inspection would inspect the keyword "var1" in a dict. The second inspection would inspect the last item of a sequence. The third inspection is a sub-inspection. It will first look into the value of it's sub-inspection by evaluating all the terms in the parenthesis as if they were a new request. These would then return a value, which would be used as the term to look into the current container. The final inspection is yet another term specified for a dictionary lookup after the sub-inspection created a dynamic lookup.

This is useful for allowing user-specified content, and expanding data-oriented development methods by making the processing of data generic, and leaving the specifics to a data-based specification that will be processed or interpretted into the specific result desired.

The attempt is to push more towards "real code" being very general in nature. It processes a formatted statement. Then the statements contain the actual goal the user is aiming for. This allows the "real code" to be hardended significantly from when it is implementing the goals directly, as human goals change frequently, and often require numerous levels of special cases to meet our demanding needs. By creating generalized processors at higher and higher levels we can use hardened and battle-tested "real code", which can validate and specify to greater precision the problems with the "goal directions", because the rules of processing are known and operating at a directed level, instead of "real code"'s totally general level, which could create anything.

This also allows for pipelining in other important processes, like regressive testing, monitoring and request authentication, which are all universal issues and have to be solved in every "real code" goal solution. With generalized processors, these issues only have to be solved once, for the generalized processor, and then all "goal directions" (chunks of information), will be processed by the general processors and get all the common functionality for "free".

TODO(g): Test with sets.

TODO(g): Move out of unidist package. It doesnt belong here. Does it?

Functions   
  __ExistsAll 
__ExistsAll (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): NoValueMissingParents, not allowed, specifically.

  CreateInspect 
CreateInspect ( terms )

Create a term sequence. Returns string: var1.-1.var2

  Get 
Get ( inspect,  data )

Calls Inspect(). This function is sugar.

  Inspect 
Inspect (
        inspect,
        data,
        subinspect_data=None,
        _current_data=None,
        )

Process the dotinspect notation from inspect, using the data as the target.

Args: inspect: string, the formatted dotted inspection string data: container, dict or sequence subinspect_data: container [optional], if there is a sub-inspection, use this other data for that. Allows some flexibility for crossing data sources, but rigid in only allowing one. That is enough for this solution set, more would complicate things too much to keep it easy. _current_data: [internal use, private], container of current place in processing the inspection.

  __Push 
__Push (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): Pop an entry off the list specified by the inspect phrase.

  __Exists 
__Exists (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): NoValue, not allowed, specifically.

  CreateSubInspect 
CreateSubInspect ( terms )
  __Pull 
__Pull (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): Pop an entry off the list specified by the inspect phrase.

  __Pop 
__Pop (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): Pop an entry off the list specified by the inspect phrase.

TODO(g): Other ways to work with data and dotinspect...

  IsSubInspect 
IsSubInspect ( term )

If this term is actually a sub-insection phrase.

  SubInspect 
SubInspect ( subinspect,  data )

Perform a sub-inspection of the data.

  __Set 
__Set (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): Pop an entry off the list specified by the inspect phrase.

  GetInspectTerms 
GetInspectTerms ( inspect )

Returns a list of inspection terms.

A term is typically a string or a number, but could also be a sub-inspection term: "var.(subvar)". In this case the sub-inspection term is returned between the parenthesis.

  __Dequeue 
__Dequeue (
        inspect,
        data,
        subinspect_data=None,
        )

TODO(g): Pop an entry off the list specified by the inspect phrase.

Classes   

EmptyContainer

The container was empty.

NoValue

No value was found.

NoValueMissingParents

No value was found, because parents of the desired inspection pount were missing.


This document was automatically generated Tue Aug 17 15:20:25 2010 by HappyDoc version 3.1