File: _realnumber.py

package info (click to toggle)
python-typepy 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 624 kB
  • sloc: python: 2,886; makefile: 78; sh: 7
file content (38 lines) | stat: -rw-r--r-- 913 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""

from typing import Any

from .._typecode import Typecode
from ._base import AbstractType


class RealNumber(AbstractType):
    """
    |result_matrix_desc|

    .. include:: matrix_realnumber_type.txt

    :py:attr:`.strict_level`
        |strict_level|
    """

    @property
    def typecode(self) -> Typecode:
        return Typecode.REAL_NUMBER

    def __init__(self, value: Any, strict_level: int = 0, **kwargs) -> None:
        super().__init__(value, strict_level, **kwargs)

    def _create_type_checker(self):
        from ..checker._realnumber import RealNumberTypeChecker

        return RealNumberTypeChecker(self._data, self._strict_level)

    def _create_type_converter(self):
        from ..converter._realnumber import FloatConverter

        converter = FloatConverter(self._data, self._params)

        return converter