Return dictionary of all objects in a namespace dictionary that match type_pattern and filter.
(namespace, type_pattern, filter, ignore_case=False, show_all=False)
| 87 | and is_type(obj, type_pattern) ) |
| 88 | |
| 89 | def list_namespace(namespace, type_pattern, filter, ignore_case=False, show_all=False): |
| 90 | """Return dictionary of all objects in a namespace dictionary that match |
| 91 | type_pattern and filter.""" |
| 92 | pattern_list=filter.split(".") |
| 93 | if len(pattern_list) == 1: |
| 94 | return filter_ns(namespace, name_pattern=pattern_list[0], |
| 95 | type_pattern=type_pattern, |
| 96 | ignore_case=ignore_case, show_all=show_all) |
| 97 | else: |
| 98 | # This is where we can change if all objects should be searched or |
| 99 | # only modules. Just change the type_pattern to module to search only |
| 100 | # modules |
| 101 | filtered = filter_ns(namespace, name_pattern=pattern_list[0], |
| 102 | type_pattern="all", |
| 103 | ignore_case=ignore_case, show_all=show_all) |
| 104 | results = {} |
| 105 | for name, obj in filtered.items(): |
| 106 | ns = list_namespace(dict_dir(obj), type_pattern, |
| 107 | ".".join(pattern_list[1:]), |
| 108 | ignore_case=ignore_case, show_all=show_all) |
| 109 | for inner_name, inner_obj in ns.items(): |
| 110 | results["%s.%s"%(name,inner_name)] = inner_obj |
| 111 | return results |