Fixups in response to PR comments

- Correct indentation.
- Only call dtype_num_to_typecode when necessary.
- Make TypeMap static.