File: _bool.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 (37 lines) | stat: -rw-r--r-- 844 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
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""

from typing import Any

from .._typecode import Typecode
from ._base import AbstractType


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

    .. include:: matrix_bool_type.txt

    .. py:attribute:: strict_level

        |strict_level|
    """

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

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

    def _create_type_checker(self):
        from ..checker._bool import BoolTypeChecker

        return BoolTypeChecker(self._data, self._strict_level)

    def _create_type_converter(self):
        from ..converter._bool import BoolConverter

        return BoolConverter(self._data, self._params)