| Conditions | 6 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 8 | def check_keys(d, separator): |
||
| 9 | """ |
||
| 10 | Check if dict keys contain keypath separator. |
||
| 11 | """ |
||
| 12 | if not isinstance(d, dict) or not separator: |
||
| 13 | return |
||
| 14 | |||
| 15 | def check_key(parent, key, value): |
||
| 16 | if key and isinstance(key, string_types) and separator in key: |
||
| 17 | raise ValueError( |
||
| 18 | 'keys should not contain keypath separator ' |
||
| 19 | '\'{}\', found: \'{}\'.'.format(separator, key)) |
||
| 20 | dict_util.traverse(d, check_key) |
||
| 21 | |||
| 37 |