Completed
Push — master ( 11b435...f96b64 )
by Matthias
53s
created

load_reader()   A

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
1
import importlib
2
3
4
def load_reader(name, host, port, group, topic):
5
    """
6
    Creates an instance of the given reader.
7
    An reader consumes messages from Kafka.
8
    """
9
    reader_module = importlib.import_module(name)
10
    reader_class = getattr(reader_module, "Reader")
11
    # Return an instance of the class
12
    return reader_class(host, port, group, topic)
13