1111"""
1212
1313import pandas .core .config as cf
14- from pandas .core .config import (is_int , is_bool , is_text , is_float ,
15- is_instance_factory , is_one_of_factory ,
16- get_default_val )
14+ from pandas .core .config import (is_int , is_bool , is_text , is_instance_factory ,
15+ is_one_of_factory , get_default_val )
1716from pandas .core .format import detect_console_encoding
1817
19-
2018#
2119# options from the "display" namespace
2220
6159
6260pc_max_categories_doc = """
6361: int
64- This sets the maximum number of categories pandas should output when printing
65- out a `Categorical` or a Series of dtype "category".
62+ This sets the maximum number of categories pandas should output when
63+ printing out a `Categorical` or a Series of dtype "category".
6664"""
6765
6866pc_max_info_cols_doc = """
146144
147145pc_east_asian_width_doc = """
148146: boolean
149- Whether to use the Unicode East Asian Width to calculate the display text width
147+ Whether to use the Unicode East Asian Width to calculate the display text
148+ width.
150149 Enabling this may affect to the performance (default: False)
151150"""
151+
152152pc_ambiguous_as_wide_doc = """
153153: boolean
154154 Whether to handle Unicode characters belong to Ambiguous as Wide (width=2)
197197: int or None
198198 df.info() will usually show null-counts for each column.
199199 For large frames this can be quite slow. max_info_rows and max_info_cols
200- limit this null check only to frames with smaller dimensions then specified.
200+ limit this null check only to frames with smaller dimensions than
201+ specified.
201202"""
202203
203204pc_large_repr_doc = """
222223
223224pc_latex_escape = """
224225: bool
225- This specifies if the to_latex method of a Dataframe uses escapes special
226+ This specifies if the to_latex method of a Dataframe uses escapes special
226227 characters.
227- method. Valid values: False,True
228+ method. Valid values: False,True
228229"""
229230
230231pc_latex_longtable = """
231232:bool
232- This specifies if the to_latex method of a Dataframe uses the longtable format.
233- method. Valid values: False,True
233+ This specifies if the to_latex method of a Dataframe uses the longtable
234+ format.
235+ method. Valid values: False,True
234236"""
235237
236238style_backup = dict ()
@@ -244,7 +246,7 @@ def mpl_style_cb(key):
244246 val = cf .get_option (key )
245247
246248 if 'matplotlib' not in sys .modules .keys ():
247- if not ( val ) : # starting up, we get reset to None
249+ if not val : # starting up, we get reset to None
248250 return val
249251 raise Exception ("matplotlib has not been imported. aborting" )
250252
@@ -267,7 +269,8 @@ def mpl_style_cb(key):
267269 validator = is_instance_factory ((int , type (None ))))
268270 cf .register_option ('max_rows' , 60 , pc_max_rows_doc ,
269271 validator = is_instance_factory ([type (None ), int ]))
270- cf .register_option ('max_categories' , 8 , pc_max_categories_doc , validator = is_int )
272+ cf .register_option ('max_categories' , 8 , pc_max_categories_doc ,
273+ validator = is_int )
271274 cf .register_option ('max_colwidth' , 50 , max_colwidth_doc , validator = is_int )
272275 cf .register_option ('max_columns' , 20 , pc_max_cols_doc ,
273276 validator = is_instance_factory ([type (None ), int ]))
@@ -305,28 +308,29 @@ def mpl_style_cb(key):
305308 cf .register_option ('line_width' , get_default_val ('display.width' ),
306309 pc_line_width_doc )
307310 cf .register_option ('memory_usage' , True , pc_memory_usage_doc ,
308- validator = is_one_of_factory ([None , True , False , 'deep' ]))
311+ validator = is_one_of_factory ([None , True ,
312+ False , 'deep' ]))
309313 cf .register_option ('unicode.east_asian_width' , False ,
310314 pc_east_asian_width_doc , validator = is_bool )
311315 cf .register_option ('unicode.ambiguous_as_wide' , False ,
312316 pc_east_asian_width_doc , validator = is_bool )
313- cf .register_option ('latex.escape' ,True , pc_latex_escape ,
314- validator = is_bool )
315- cf .register_option ('latex.longtable' ,False ,pc_latex_longtable ,
316- validator = is_bool )
317+ cf .register_option ('latex.escape' , True , pc_latex_escape ,
318+ validator = is_bool )
319+ cf .register_option ('latex.longtable' , False , pc_latex_longtable ,
320+ validator = is_bool )
317321
318322cf .deprecate_option ('display.line_width' ,
319323 msg = pc_line_width_deprecation_warning ,
320324 rkey = 'display.width' )
321325
322- cf .deprecate_option ('display.height' ,
323- msg = pc_height_deprecation_warning ,
326+ cf .deprecate_option ('display.height' , msg = pc_height_deprecation_warning ,
324327 rkey = 'display.max_rows' )
325328
326329tc_sim_interactive_doc = """
327330: boolean
328331 Whether to simulate interactive mode for purposes of testing
329332"""
333+
330334with cf .config_prefix ('mode' ):
331335 cf .register_option ('sim_interactive' , False , tc_sim_interactive_doc )
332336
@@ -349,7 +353,6 @@ def use_inf_as_null_cb(key):
349353 cf .register_option ('use_inf_as_null' , False , use_inf_as_null_doc ,
350354 cb = use_inf_as_null_cb )
351355
352-
353356# user warnings
354357chained_assignment = """
355358: string
@@ -361,7 +364,6 @@ def use_inf_as_null_cb(key):
361364 cf .register_option ('chained_assignment' , 'warn' , chained_assignment ,
362365 validator = is_one_of_factory ([None , 'warn' , 'raise' ]))
363366
364-
365367# Set up the io.excel specific configuration.
366368writer_engine_doc = """
367369: string
@@ -371,8 +373,7 @@ def use_inf_as_null_cb(key):
371373
372374with cf .config_prefix ('io.excel' ):
373375 # going forward, will be additional writers
374- for ext , options in [('xls' , ['xlwt' ]),
375- ('xlsm' , ['openpyxl' ])]:
376+ for ext , options in [('xls' , ['xlwt' ]), ('xlsm' , ['openpyxl' ])]:
376377 default = options .pop (0 )
377378 if options :
378379 options = " " + ", " .join (options )
@@ -384,14 +385,13 @@ def use_inf_as_null_cb(key):
384385
385386 def _register_xlsx (engine , other ):
386387 cf .register_option ('xlsx.writer' , engine ,
387- writer_engine_doc .format (ext = 'xlsx' ,
388- default = engine ,
388+ writer_engine_doc .format (ext = 'xlsx' , default = engine ,
389389 others = ", '%s'" % other ),
390390 validator = str )
391391
392392 try :
393393 # better memory footprint
394- import xlsxwriter
394+ import xlsxwriter # noqa
395395 _register_xlsx ('xlsxwriter' , 'openpyxl' )
396396 except ImportError :
397397 # fallback
0 commit comments