Package gmisclib :: Module g2_select
[frames] | no frames]

Module g2_select

source code

Classes
  selector_c
Functions
list(dict(str: value))
filterlist(s, d, verbose=False)
This filters a list of dictionaries, passing ones where the selector returns true.
source code
 
filter_iter(s, d, verbose=False)
This filters a list of lines, passing ones where the selector returns true.
source code
 
accept(s, d)
This checks a single dictionary, and returns the result of the selector.
source code
 
whynot(s, d)
Returns an explanation of why d was not accepted, given s, or None of d was accepted.
source code
 
why(s, d)
Returns an explanation of why d was accepted, given s, or None if d was not accepted.
source code
 
evaluate(s, d)
This checks a single dictionary, and returns the result of the selector.
source code
 
test() source code
Variables
  CCSZ = 100
  __package__ = 'gmisclib'

Imports: math, die, avio, load_mod


Function Details

filterlist(s, d, verbose=False)

source code 

This filters a list of dictionaries, passing ones where the selector returns true.

Parameters:
  • s (str) - the selector -- a little snippet of python
  • d ( list(dict(str:value)) ) - the list of dictionaries. Each dictionary is temporarily used as the local variable space and the selector is evaluated.
Returns: list(dict(str: value))
a subset of the input list, whichever dictionaries cause s to return True when evaluated.

filter_iter(s, d, verbose=False)

source code 

This filters a list of lines, passing ones where the selector returns true. S is the selector -- a little snippet of python, and d is the list of data : a list of {k:v} mappings.

accept(s, d)

source code 

This checks a single dictionary, and returns the result of the selector. Errors in the evaluation are trapped and cause accept() to return False. S is the selector -- a little snippet of python, and d is the data : a {k:v} mapping.

evaluate(s, d)

source code 

This checks a single dictionary, and returns the result of the selector. S is the selector -- a little snippet of python, and d is the data : a {k:v} mapping.