b42b39742cf6dffe0d3d555e056d276c960b8ac3,reframe/core/fields.py,TimerField,__set__,#TimerField#Any#Any#,108

Before Change


                                 "non-negative values")

            if m > 59 or s > 59:
                raise ValueError("minutes and seconds in a timer "
                                 "field must not exceed 59")

        // Call Field"s __set__() method, type checking is already performed
        Field.__set__(self, obj, value)

After Change


        self._check_type(value)
        if value and type(value) is not datetime.timedelta:
            try:
                time_dict = re.match(r"^((?P<days>\d+)d)*"
                                     r"((?P<hours>\d+)h)*"
                                     r"((?P<minutes>\d+)m)*"
                                     r"((?P<seconds>\d+)s)*$",
                                     value).groupdict()
            except AttributeError:
                raise Exception("invalid format")

            value = datetime.timedelta(**{k:int(v) for k, v in time_dict.items() if v})

        // Call Field"s __set__() method, type checking is already performed
        Field.__set__(self, obj, value)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: eth-cscs/reframe
Commit Name: b42b39742cf6dffe0d3d555e056d276c960b8ac3
Time: 2020-01-27
Author: rafael.sarmiento@cscs.ch
File Name: reframe/core/fields.py
Class Name: TimerField
Method Name: __set__


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: bd3a1021d7d990d5d4a8a71cc0621485af2d09e4
Time: 2019-09-03
Author: chriswilkes@google.com
File Name: perfkitbenchmarker/linux_virtual_machine.py
Class Name: LsCpuResults
Method Name: __init__


Project Name: eth-cscs/reframe
Commit Name: 2e180b4eda979e3455df916c89cb0295370fc7d7
Time: 2018-06-07
Author: rafael.sarmiento@cscs.ch
File Name: reframe/utility/versioning.py
Class Name: _RelationalValidator
Method Name: __init__