|
3 | 3 | __all__ = ['defaults', 'ifnone', 'maybe_attr', 'basic_repr', 'is_array', 'listify', 'get_class', 'mk_class', |
4 | 4 | 'wrap_class', 'ignore_exceptions', 'exec_local', 'risinstance', 'Inf', 'in_', 'lt', 'gt', 'le', 'ge', 'eq', |
5 | 5 | 'ne', 'add', 'sub', 'mul', 'truediv', 'is_', 'is_not', 'in_', 'true', 'stop', 'gen', 'chunked', 'otherwise', |
6 | | - 'AttrDict', 'with_cast', 'store_attr', 'attrdict', 'properties', 'camel2snake', 'snake2camel', 'class2attr', |
7 | | - 'hasattrs', 'setattrs', 'try_attrs', 'ShowPrint', 'Int', 'Str', 'Float', 'detuplify', 'replicate', 'setify', |
8 | | - 'merge', 'range_of', 'groupby', 'last_index', 'filter_dict', 'filter_keys', 'filter_values', 'cycle', |
9 | | - 'zip_cycle', 'sorted_ex', 'negate_func', 'argwhere', 'filter_ex', 'range_of', 'renumerate', 'first', |
10 | | - 'nested_attr', 'nested_idx', 'num_methods', 'rnum_methods', 'inum_methods', 'fastuple', 'arg0', 'arg1', |
11 | | - 'arg2', 'arg3', 'arg4', 'bind', 'map_ex', 'compose', 'maps', 'partialler', 'instantiate', 'using_attr', |
12 | | - 'Self', 'Self', 'PrettyString', 'even_mults', 'num_cpus', 'add_props', 'typed'] |
| 6 | + 'custom_dir', 'AttrDict', 'with_cast', 'store_attr', 'attrdict', 'properties', 'camel2snake', 'snake2camel', |
| 7 | + 'class2attr', 'hasattrs', 'setattrs', 'try_attrs', 'ShowPrint', 'Int', 'Str', 'Float', 'detuplify', |
| 8 | + 'replicate', 'setify', 'merge', 'range_of', 'groupby', 'last_index', 'filter_dict', 'filter_keys', |
| 9 | + 'filter_values', 'cycle', 'zip_cycle', 'sorted_ex', 'negate_func', 'argwhere', 'filter_ex', 'range_of', |
| 10 | + 'renumerate', 'first', 'nested_attr', 'nested_idx', 'num_methods', 'rnum_methods', 'inum_methods', |
| 11 | + 'fastuple', 'arg0', 'arg1', 'arg2', 'arg3', 'arg4', 'bind', 'map_ex', 'compose', 'maps', 'partialler', |
| 12 | + 'instantiate', 'using_attr', 'Self', 'Self', 'PrettyString', 'even_mults', 'num_cpus', 'add_props', 'typed'] |
13 | 13 |
|
14 | 14 | # Cell |
15 | 15 | from .imports import * |
@@ -178,6 +178,11 @@ def otherwise(x, tst, y): |
178 | 178 | "`y if tst(x) else x`" |
179 | 179 | return y if tst(x) else x |
180 | 180 |
|
| 181 | +# Cell |
| 182 | +def custom_dir(c, add:list): |
| 183 | + "Implement custom `__dir__`, adding `add` to `cls`" |
| 184 | + return dir(type(c)) + list(c.__dict__.keys()) + add |
| 185 | + |
181 | 186 | # Cell |
182 | 187 | class AttrDict(dict): |
183 | 188 | "`dict` subclass that also provides access to keys as attrs" |
|
0 commit comments