<s> from agate . aggregations . base import Aggregation <EOL> from agate . aggregations . has_nulls import HasNulls <EOL> from agate . aggregations . percentiles import Percentiles <EOL> from agate . data_types import Number <EOL> from agate . exceptions import DataTypeError <EOL> from agate . utils import Quantiles <EOL> from agate . warns import warn_null_calculation <EOL> class Deciles ( Aggregation ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , column_name ) : <EOL> self . _column_name = column_name <EOL> def validate ( self , table ) : <EOL> column = table . columns [ self . _column_name ] <EOL> if not isinstance ( column . data_type , Number ) : <EOL> raise DataTypeError ( '<STR_LIT>' ) <EOL> has_nulls = HasNulls ( self . _column_name ) . run ( table ) <EOL> if has_nulls : <EOL> warn_null_calculation ( self , column ) <EOL> def run ( self , table ) : <EOL> """<STR_LIT>""" <EOL> percentiles = Percentiles ( self . _column_name ) . run ( table ) <EOL> return Quantiles ( [ percentiles [ i ] for i in range ( <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:10> ) ] ) </s>
