Detail: Quilt: Accessor Type Clinic

Overview: Quilt: Accessor Type Clinic

Quilt.via_type_clinic.to_hint
Quilt.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.

>>> q = sf.Quilt.from_frame(sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x'), retain_labels=True, chunksize=2)
>>> q
<Quilt: x>
<Index: Aligned> a b c <<U1>
<Index: Frames>
0                . . .
2                . . .
<int64>
>>> q.via_type_clinic.to_hint()
<class 'static_frame.core.quilt.Quilt'>
Quilt.via_type_clinic.check(hint, *, fail_fast)
Quilt.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.

>>> q = sf.Quilt.from_frame(sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x'), retain_labels=True, chunksize=2)
>>> q
<Quilt: x>
<Index: Aligned> a b c <<U1>
<Index: Frames>
0                . . .
2                . . .
<int64>
>>> q.via_type_clinic.check(sf.Frame)
ClinicError('\nExpected Frame, provided Quilt invalid')
Quilt.via_type_clinic.warn(hint, *, fail_fast, category)
Quilt.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.

Quilt.via_type_clinic.__call__(hint, *, fail_fast)
Quilt.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.

>>> q = sf.Quilt.from_frame(sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x'), retain_labels=True, chunksize=2)
>>> q
<Quilt: x>
<Index: Aligned> a b c <<U1>
<Index: Frames>
0                . . .
2                . . .
<int64>
>>> cr = q.via_type_clinic(sf.Frame)
>>> cr
<ClinicResult: 1 error>
>>> cr.validated
False
>>> cr.to_str()

Expected Frame, provided Quilt invalid
Quilt.via_type_clinic.__repr__
Quilt.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.

>>> q = sf.Quilt.from_frame(sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x'), retain_labels=True, chunksize=2)
>>> q
<Quilt: x>
<Index: Aligned> a b c <<U1>
<Index: Frames>
0                . . .
2                . . .
<int64>
>>> q.via_type_clinic
Quilt

Quilt: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic