Debian Codegraph @

asdf_astropy/converters/utils.py

raw
1 import importlib
2
3
4 def import_type(type_name):
5 """
6 Import a Python type from its fully-qualified name.
7 For example, when this method is called with 'builtins.str'
8 it will return the `str` type.
9
10 Parameters
11 ----------
12 type_name : str
13 Type name, with module.
14
15 Returns
16 -------
17 type
18 """
19 module_name, class_name = type_name.rsplit(".", 1)
20 return getattr(importlib.import_module(module_name), class_name)