Total Complexity | 2 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
1 | # -*- coding: utf-8 -*- |
||
9 | 1 | class MainSectionParser(ValuesParser): |
|
10 | """ |
||
11 | Parses ``MAIN`` section. |
||
12 | View :ref:`detailed description <main-section>`. |
||
13 | """ |
||
14 | |||
15 | 1 | def check_section_name(self, section_name): |
|
16 | """ |
||
17 | Implements abstract method. See |
||
18 | :meth:`SectionParser.check_section_name` for semantics. |
||
19 | """ |
||
20 | 1 | return section_name == "MAIN" |
|
21 | |||
22 | 1 | def clean(self): |
|
23 | """ |
||
24 | Redefines base method. See :meth:`SectionParser.clean` for |
||
25 | semantics. |
||
26 | """ |
||
27 | 1 | weather_conditions = int(self.data['CloudType']) |
|
28 | 1 | return { |
|
29 | 'location_loader': self.data['MAP'], |
||
30 | 'time': { |
||
31 | 'value': to_time(self.data['TIME']), |
||
32 | 'is_fixed': 'TIMECONSTANT' in self.data, |
||
33 | }, |
||
34 | 'weather_conditions': Conditions.get_by_value(weather_conditions), |
||
35 | 'cloud_base': int(float(self.data['CloudHeight'])), |
||
36 | 'player': { |
||
37 | 'belligerent': to_belligerent(self.data['army']), |
||
38 | 'flight_id': self.data.get('player'), |
||
39 | 'aircraft_index': int(self.data['playerNum']), |
||
40 | 'fixed_weapons': 'WEAPONSCONSTANT' in self.data, |
||
41 | }, |
||
43 |