| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| 1 | # -*- coding: utf-8 -*- |
||
| 8 | 1 | class WeatherSectionParser(ValuesParser): |
|
| 9 | """ |
||
| 10 | Parses ``WEATHER`` section. |
||
| 11 | View :ref:`detailed description <weather-section>`. |
||
| 12 | """ |
||
| 13 | |||
| 14 | 1 | def check_section_name(self, section_name): |
|
| 15 | """ |
||
| 16 | Implements abstract method. See |
||
| 17 | :meth:`SectionParser.check_section_name` for semantics. |
||
| 18 | """ |
||
| 19 | 1 | return section_name == "WEATHER" |
|
| 20 | |||
| 21 | 1 | def clean(self): |
|
| 22 | """ |
||
| 23 | Redefines base method. See :meth:`SectionParser.clean` for |
||
| 24 | semantics. |
||
| 25 | """ |
||
| 26 | 1 | gust = int(self.data['Gust']) |
|
| 27 | 1 | turbulence = int(self.data['Turbulence']) |
|
| 28 | 1 | return { |
|
| 29 | 'weather': { |
||
| 30 | 'wind': { |
||
| 31 | 'direction': float(self.data['WindDirection']), |
||
| 32 | 'speed': float(self.data['WindSpeed']), |
||
| 33 | }, |
||
| 34 | 'gust': Gust.get_by_value(gust), |
||
| 35 | 'turbulence': Turbulence.get_by_value(turbulence), |
||
| 36 | }, |
||
| 38 |