Package translate :: Package storage :: Package xml_extract :: Module misc |
[hide private]
[frames] | no frames]

# Module misc

source code

Functions | [hide private]
reduce_tree(f, parent_unit_node, unit_node, get_children, *state) Enumerate a tree, applying f to in a pre-order fashion to each node. | source code
compose_mappings(left, right) Given two mappings left: A -> B and right: B -> C, create a hash result_map: A -> C. | source code
parse_tag(full_tag) | source code

Variables | [hide private]
| tag_pattern = `re.compile(r'`(`\{`(?P<``namespace``>``(`\w`|``[`-:\./`]``)``*``)`\}`)``?``...``

Imports: re, accepts, Self, IsCallable, IsOneOf, Any

Function Details | [hide private]

### reduce_tree(f, parent_unit_node, unit_node, get_children, *state) | source code
Enumerate a tree, applying f to in a pre-order fashion to each node. parent_unit_node contains the parent of unit_node. For the root of the tree, parent_unit_node == unit_node. get_children is a single argument function applied to a unit_node to get a list/iterator to its children. state is used by f to modify state information relating to whatever f does to the tree. Decorators: `@accepts(IsCallable(), Any(), Any(), IsCallable(), state= [Any()])`

### compose_mappings(left, right) | source code
Given two mappings left: A -> B and right: B -> C, create a hash result_map: A -> C. Only values in left (i.e. things from B) which have corresponding keys in right will have their keys mapped to values in right.

Variables Details | [hide private]

  ### tag_pattern Value:
      re.compile(r'(\{(?P<namespace>(\w|[-:\./])*)\})?(?P<tag>(\w|-)*)')