Detail: IndexGO: Accessor Type Clinic

Overview: IndexGO: Accessor Type Clinic

IndexGO.via_type_clinic.to_hint
IndexGO.via_type_clinic
TypeClinic.to_hint()[source]

Return the type hint (the type and/or generic aliases necessary) to represent the object given at initialization.

>>> ix = sf.IndexGO(('a', 'b', 'c', 'd', 'e'), name='x')
>>> ix
<IndexGO: x>
a
b
c
d
e
<<U1>
>>> ix.via_type_clinic.to_hint()
static_frame.core.index.IndexGO[numpy.str_]
IndexGO.via_type_clinic.check(hint, *, fail_fast)
IndexGO.via_type_clinic
TypeClinic.check(hint, /, *, fail_fast=False)[source]

Given a hint (a type and/or generic alias), raise a ClinicError exception describing the result of the check if an error is found.

Parameters:

fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

>>> ix = sf.IndexGO(('a', 'b', 'c', 'd', 'e'), name='x')
>>> ix
<IndexGO: x>
a
b
c
d
e
<<U1>
>>> ix.via_type_clinic.check(sf.Index[np.int64])
ClinicError('\nIn Index[int64]\n└── Expected int64, provided str_ invalid')
IndexGO.via_type_clinic.warn(hint, *, fail_fast, category)
IndexGO.via_type_clinic
TypeClinic.warn(hint, /, *, fail_fast=False, category=<class 'UserWarning'>)[source]

Given a hint (a type and/or generic alias), issue a warning describing the result of the check if an error is found.

Parameters:
  • fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

  • category – The Warning subclass to be used for issueing the warning.

IndexGO.via_type_clinic.__call__(hint, *, fail_fast)
IndexGO.via_type_clinic
TypeClinic.__call__(hint, /, *, fail_fast=False)[source]

Given a hint (a type and/or generic alias), return a ClinicResult object describing the result of the check.

Parameters:

fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

>>> ix = sf.IndexGO(('a', 'b', 'c', 'd', 'e'), name='x')
>>> ix
<IndexGO: x>
a
b
c
d
e
<<U1>
>>> cr = ix.via_type_clinic(sf.Index[np.int64])
>>> cr
<ClinicResult: 1 error>
>>> cr.validated
False
>>> cr.to_str()

In Index[int64]
└── Expected int64, provided str_ invalid
IndexGO.via_type_clinic.__repr__
IndexGO.via_type_clinic
TypeClinic.__repr__()[source]

Return a compact string representation of the type hint (the type and/or generic aliases necessary) to represent the object given at initialization.

>>> ix = sf.IndexGO(('a', 'b', 'c', 'd', 'e'), name='x')
>>> ix
<IndexGO: x>
a
b
c
d
e
<<U1>
>>> ix.via_type_clinic
IndexGO[str_]

IndexGO: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic