This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/util/dynamic.py
2019-11-12 11:09:47 -05:00

7 lines
275 B
Python

def import_class(module_name, class_name):
""" Import a class given the specified module name and class name. """
klass = __import__(module_name)
class_segments = class_name.split('.')
for segment in class_segments:
klass = getattr(klass, segment)
return klass