Completed
Push — master ( 025da3...410210 )
by Oleksandr
01:36
created

il2fb.parsers.mission.sections.SeasonParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%
Metric Value
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A clean() 0 11 1
A check_section_name() 0 6 1
1
# -*- coding: utf-8 -*-
2
3 1
import datetime
4
5 1
from . import ValuesParser
6
7
8 1
class SeasonParser(ValuesParser):
9
    """
10
    Parses ``SEASON`` section.
11
    View :ref:`detailed description <season-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 == "SEASON"
20
21 1
    def clean(self):
22
        """
23
        Redefines base method. See :meth:`SectionParser.clean` for
24
        semantics.
25
26
        Combines day, time and year into :class:`datetime.date` object.
27
        """
28 1
        date = datetime.date(int(self.data['Year']),
29
                             int(self.data['Month']),
30
                             int(self.data['Day']))
31
        return {'date': date, }
32