Conditions | 2 |
Total Lines | 19 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | """Known decoding.""" |
||
10 | def get_decode(name): |
||
11 | """ |
||
12 | Get decoding function by name. |
||
13 | |||
14 | Decoding should be a function that takes |
||
15 | a `bytes` input and returns a `str` result. |
||
16 | |||
17 | :param str name: a decode name |
||
18 | |||
19 | :return: the resulting decode |
||
20 | :rtype: callable |
||
21 | """ |
||
22 | |||
23 | decode = CACHE.get(name) |
||
|
|||
24 | |||
25 | if not decode: |
||
26 | decode = CACHE[name] = importlib.import_module(f".{name}", __name__).decode |
||
27 | |||
28 | return decode |
||
29 |