MCPcopy Create free account
hub / github.com/ipython/traitlets / CInt

Class CInt

traitlets/traitlets.py:2666–2711  ·  view source on GitHub ↗

A casting version of the int trait.

Source from the content-addressed store, hash-verified

2664
2665
2666class CInt(Int[G, S]):
2667 """A casting version of the int trait."""
2668
2669 if t.TYPE_CHECKING:
2670
2671 @t.overload
2672 def __init__(
2673 self: CInt[int, t.Any],
2674 default_value: t.Any | Sentinel = ...,
2675 allow_none: Literal[False] = ...,
2676 read_only: bool | None = ...,
2677 help: str | None = ...,
2678 config: t.Any | None = ...,
2679 **kwargs: t.Any,
2680 ) -> None:
2681 ...
2682
2683 @t.overload
2684 def __init__(
2685 self: CInt[int | None, t.Any],
2686 default_value: t.Any | Sentinel | None = ...,
2687 allow_none: Literal[True] = ...,
2688 read_only: bool | None = ...,
2689 help: str | None = ...,
2690 config: t.Any | None = ...,
2691 **kwargs: t.Any,
2692 ) -> None:
2693 ...
2694
2695 def __init__(
2696 self: CInt[int | None, t.Any],
2697 default_value: t.Any | Sentinel | None = ...,
2698 allow_none: bool = ...,
2699 read_only: bool | None = ...,
2700 help: str | None = ...,
2701 config: t.Any | None = ...,
2702 **kwargs: t.Any,
2703 ) -> None:
2704 ...
2705
2706 def validate(self, obj: t.Any, value: t.Any) -> G:
2707 try:
2708 value = int(value)
2709 except Exception:
2710 self.error(obj, value)
2711 return _validate_bounds(self, obj, value) # type:ignore[no-any-return]
2712
2713
2714Long, CLong = Int, CInt

Callers 5

FooClass · 0.90
CIntTraitClass · 0.90
MinBoundCIntTraitClass · 0.90
TClass · 0.90
mypy_cint_typingFunction · 0.90

Calls

no outgoing calls

Tested by 1

mypy_cint_typingFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…