Conditions | 5 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | """binary representation modes used for a StarStruct object.""" |
||
27 | 1 | @staticmethod |
|
28 | def from_byteorder(val): |
||
29 | """ |
||
30 | Convert a byteorder string such as used by the to_bytes() or |
||
31 | from_bytes() functions into a Mode value. |
||
32 | """ |
||
33 | 1 | if val == 'little': |
|
34 | 1 | return Mode.Little |
|
35 | 1 | elif val == 'big': |
|
36 | 1 | return Mode.Big |
|
37 | 1 | elif val == 'native': # custom |
|
38 | 1 | return Mode.Native |
|
39 | 1 | elif val == 'network': # custom |
|
40 | 1 | return Mode.Network |
|
41 | raise TypeError('{} not a valid byteorder'.format(val)) |
||
42 |