Completed
Push — master ( caabd8...c07396 )
by Oleksandr
01:11
created

clean()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
cc 1
dl 0
loc 11
ccs 3
cts 3
cp 1
crap 1
rs 9.4286
1
# -*- coding: utf-8 -*-
2
3 1
import datetime
4
5 1
from . import ValuesParser
6
7
8 1
class SeasonSectionParser(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