Detail: Batch: Accessor Type Clinic
Overview: Batch: Accessor Type Clinic
- Batch.via_type_clinic.to_hint
- Batch.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.
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x')))) >>> bt <Batch max_workers=None> >>> bt.via_type_clinic.to_hint() <class 'static_frame.core.batch.Batch'>
- Batch.via_type_clinic.check(hint, *, fail_fast)
- Batch.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.
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x')))) >>> bt <Batch max_workers=None> >>> bt.via_type_clinic.check(sf.Frame) ClinicError('\nExpected Frame, provided Batch invalid')
- Batch.via_type_clinic.warn(hint, *, fail_fast, category)
- Batch.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.
- Batch.via_type_clinic.__call__(hint, *, fail_fast)
- Batch.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.
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x')))) >>> bt <Batch max_workers=None> >>> cr = bt.via_type_clinic(sf.Frame) >>> cr <ClinicResult: 1 error> >>> cr.validated False >>> cr.to_str() Expected Frame, provided Batch invalid
- Batch.via_type_clinic.__repr__
- Batch.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.
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x')))) >>> bt <Batch max_workers=None> >>> bt.via_type_clinic Batch
Batch: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic | Accessor Reduce