|
9 | 9 | 'GetAttrBase', 'GetAttr', 'delegate_attr', 'ShowPrint', 'Int', 'Str', 'Float', 'flatten', 'concat', 'strcat',
|
10 | 10 | 'detuplify', 'replicate', 'setify', 'merge', 'range_of', 'groupby', 'last_index', 'filter_dict',
|
11 | 11 | 'filter_keys', 'filter_values', 'cycle', 'zip_cycle', 'sorted_ex', 'not_', 'argwhere', 'filter_ex',
|
12 |
| - 'range_of', 'renumerate', 'first', 'nested_attr', 'nested_idx', 'set_nested_idx', 'val2idx', 'uniqueify', |
13 |
| - 'loop_first_last', 'loop_first', 'loop_last', 'num_methods', 'rnum_methods', 'inum_methods', 'fastuple', |
14 |
| - 'arg0', 'arg1', 'arg2', 'arg3', 'arg4', 'bind', 'mapt', 'map_ex', 'compose', 'maps', 'partialler', |
15 |
| - 'instantiate', 'using_attr', 'Self', 'Self', 'copy_func', 'patch_to', 'patch', 'patch_property', |
16 |
| - 'compile_re', 'ImportEnum', 'StrEnum', 'str_enum', 'Stateful', 'PrettyString', 'even_mults', 'num_cpus', |
17 |
| - 'add_props', 'typed', 'exec_new', 'exec_import'] |
| 12 | + 'range_of', 'renumerate', 'first', 'nested_attr', 'nested_callable', 'nested_idx', 'set_nested_idx', |
| 13 | + 'val2idx', 'uniqueify', 'loop_first_last', 'loop_first', 'loop_last', 'num_methods', 'rnum_methods', |
| 14 | + 'inum_methods', 'fastuple', 'arg0', 'arg1', 'arg2', 'arg3', 'arg4', 'bind', 'mapt', 'map_ex', 'compose', |
| 15 | + 'maps', 'partialler', 'instantiate', 'using_attr', 'Self', 'Self', 'copy_func', 'patch_to', 'patch', |
| 16 | + 'patch_property', 'compile_re', 'ImportEnum', 'StrEnum', 'str_enum', 'Stateful', 'PrettyString', |
| 17 | + 'even_mults', 'num_cpus', 'add_props', 'typed', 'exec_new', 'exec_import'] |
18 | 18 |
|
19 | 19 | # Cell
|
20 | 20 | from .imports import *
|
@@ -628,6 +628,11 @@ def nested_attr(o, attr, default=None):
|
628 | 628 | except AttributeError: return default
|
629 | 629 | return o
|
630 | 630 |
|
| 631 | +# Cell |
| 632 | +def nested_callable(o, attr): |
| 633 | + "Same as `nested_attr` but if not found will return `noop`" |
| 634 | + return nested_attr(o, attr, noop) |
| 635 | + |
631 | 636 | # Cell
|
632 | 637 | def _access(coll, idx): return coll.get(idx, None) if hasattr(coll, 'get') else coll[idx] if idx<len(coll) else None
|
633 | 638 |
|
|
0 commit comments