Detail: Yarn: Accessor Type Clinic
Overview: Yarn: Accessor Type Clinic
- Yarn.via_type_clinic.to_hint
- Yarn.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.
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.via_type_clinic.to_hint() static_frame.core.yarn.Yarn[static_frame.core.index_hierarchy.IndexHierarchy[static_frame.core.index.Index[numpy.str_], static_frame.core.index.Index[numpy.str_]]]
- Yarn.via_type_clinic.check(hint, *, fail_fast)
- Yarn.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.
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.via_type_clinic.check(sf.Yarn[sf.Index[np.int64]]) ClinicError('\nIn Yarn[Index[int64]]\n└── Expected Index, provided IndexHierarchy invalid')
- Yarn.via_type_clinic.warn(hint, *, fail_fast, category)
- Yarn.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.
- Yarn.via_type_clinic.__call__(hint, *, fail_fast)
- Yarn.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.
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> cr = y.via_type_clinic(sf.Yarn[sf.Index[np.int64]]) >>> cr <ClinicResult: 1 error> >>> cr.validated False >>> cr.to_str() In Yarn[Index[int64]] └── Expected Index, provided IndexHierarchy invalid
- Yarn.via_type_clinic.__repr__
- Yarn.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.
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.via_type_clinic Yarn[IndexHierarchy[Index[str_], Index[str_]]]
Yarn: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic