Convert string or int coord frame into int.
(cf)
| 79 | |
| 80 | |
| 81 | def _to_const(cf): |
| 82 | """Convert string or int coord frame into int.""" |
| 83 | if isinstance(cf, str): |
| 84 | if cf not in _str_to_frame: |
| 85 | raise ValueError( |
| 86 | f"Unknown coordinate frame {cf}, " |
| 87 | 'expected "' + '", "'.join(_str_to_frame.keys()) + '"' |
| 88 | ) |
| 89 | cf = _str_to_frame[cf] |
| 90 | else: |
| 91 | cf = _ensure_int(cf, "coordinate frame", "a str or int") |
| 92 | return int(cf) |
| 93 | |
| 94 | |
| 95 | class Transform(dict): |
no test coverage detected