| Conditions | 3 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from typing import Mapping |
||
| 4 | def rename_keys(record: Mapping, key_map: Mapping) -> dict: |
||
| 5 | """New record with same keys or renamed keys if key found in key_map.""" |
||
| 6 | |||
| 7 | new_record = dict() |
||
| 8 | |||
| 9 | for k, v in record.items(): |
||
| 10 | key = key_map[k] if k in key_map else k |
||
| 11 | new_record[key] = v |
||
| 12 | |||
| 13 | return new_record |
||
| 14 | |||
| 20 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.