<s> from warnings import warn <EOL> from . import chart <EOL> class ChartPie ( chart . Chart ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , options = None ) : <EOL> """<STR_LIT>""" <EOL> super ( ChartPie , self ) . __init__ ( ) <EOL> if options is None : <EOL> options = { } <EOL> self . vary_data_color = <NUM_LIT:1> <EOL> self . rotation = <NUM_LIT:0> <EOL> self . label_position_default = '<STR_LIT>' <EOL> self . label_positions = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> def set_rotation ( self , rotation ) : <EOL> """<STR_LIT>""" <EOL> if rotation is None : <EOL> return <EOL> if rotation < <NUM_LIT:0> or rotation > <NUM_LIT> : <EOL> warn ( "<STR_LIT>" <EOL> % rotation ) <EOL> return <EOL> self . rotation = int ( rotation ) <EOL> def _write_chart_type ( self , args ) : <EOL> self . _write_pie_chart ( args ) <EOL> def _write_pie_chart ( self , args ) : <EOL> self . _xml_start_tag ( '<STR_LIT>' ) <EOL> self . _write_vary_colors ( ) <EOL> for data in self . series : <EOL> self . _write_ser ( data ) <EOL> self . _write_first_slice_ang ( ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_plot_area ( self ) : <EOL> self . _xml_start_tag ( '<STR_LIT>' ) <EOL> self . _write_layout ( self . plotarea . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . _write_chart_type ( None ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_legend ( self ) : <EOL> position = self . legend_position <EOL> font = self . legend_font <EOL> delete_series = [ ] <EOL> overlay = <NUM_LIT:0> <EOL> if ( self . legend_delete_series is not None <EOL> and type ( self . legend_delete_series ) is list ) : <EOL> delete_series = self . legend_delete_series <EOL> if position . startswith ( '<STR_LIT>' ) : <EOL> position = position . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> overlay = <NUM_LIT:1> <EOL> allowed = { <EOL> '<STR_LIT:right>' : '<STR_LIT:r>' , <EOL> '<STR_LIT:left>' : '<STR_LIT:l>' , <EOL> '<STR_LIT>' : '<STR_LIT:t>' , <EOL> '<STR_LIT>' : '<STR_LIT:b>' , <EOL> } <EOL> if position == '<STR_LIT:none>' : <EOL> return <EOL> if position not in allowed : <EOL> return <EOL> position = allowed [ position ] <EOL> self . _xml_start_tag ( '<STR_LIT>' ) <EOL> self . _write_legend_pos ( position ) <EOL> for index in delete_series : <EOL> self . _write_legend_entry ( index ) <EOL> self . _write_layout ( self . legend_layout , '<STR_LIT>' ) <EOL> if overlay : <EOL> self . _write_overlay ( ) <EOL> self . _write_tx_pr_legend ( None , font ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_tx_pr_legend ( self , horiz , font ) : <EOL> if font and font . get ( '<STR_LIT>' ) : <EOL> rotation = font [ '<STR_LIT>' ] <EOL> else : <EOL> rotation = None <EOL> self . _xml_start_tag ( '<STR_LIT>' ) <EOL> self . _write_a_body_pr ( rotation , horiz ) <EOL> self . _write_a_lst_style ( ) <EOL> self . _write_a_p_legend ( font ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_a_p_legend ( self , font ) : <EOL> self . _xml_start_tag ( '<STR_LIT>' ) <EOL> self . _write_a_p_pr_legend ( font ) <EOL> self . _write_a_end_para_rpr ( ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_a_p_pr_legend ( self , font ) : <EOL> attributes = [ ( '<STR_LIT>' , <NUM_LIT:0> ) ] <EOL> self . _xml_start_tag ( '<STR_LIT>' , attributes ) <EOL> self . _write_a_def_rpr ( font ) <EOL> self . _xml_end_tag ( '<STR_LIT>' ) <EOL> def _write_vary_colors ( self ) : <EOL> attributes = [ ( '<STR_LIT>' , <NUM_LIT:1> ) ] <EOL> self . _xml_empty_tag ( '<STR_LIT>' , attributes ) <EOL> def _write_first_slice_ang ( self ) : <EOL> attributes = [ ( '<STR_LIT>' , self . rotation ) ] <EOL> self . _xml_empty_tag ( '<STR_LIT>' , attributes ) </s>
