@@ -70,7 +70,7 @@ def _pipe_segment_with_colons(align, colwidth):
7070 """Return a segment of a horizontal line with optional colons which
7171 indicate column's alignment (as in `pipe` output format)."""
7272 w = colwidth
73- if align in [ "right" , "decimal" ] :
73+ if align in { "right" , "decimal" } :
7474 return ("-" * (w - 1 )) + ":"
7575 elif align == "center" :
7676 return ":" + ("-" * (w - 2 )) + ":"
@@ -176,7 +176,7 @@ def _isconvertible(conv, string):
176176def _isnumber (string ):
177177 return (
178178 # fast path
179- type (string ) in ( float , int )
179+ type (string ) in { float , int }
180180 # covers 'NaN', +/- 'inf', and eg. '1e2', as well as any type
181181 # convertible to int/float.
182182 or (
@@ -188,7 +188,7 @@ def _isnumber(string):
188188 # just an over/underflow
189189 or (
190190 not (math .isinf (float (string )) or math .isnan (float (string )))
191- or string .lower () in [ "inf" , "-inf" , "nan" ]
191+ or string .lower () in { "inf" , "-inf" , "nan" }
192192 )
193193 )
194194 )
@@ -210,7 +210,7 @@ def _isint(string, inttype=int):
210210
211211def _isbool (string ):
212212 return type (string ) is bool or (
213- isinstance (string , (bytes , str )) and string in ( "True" , "False" )
213+ isinstance (string , (bytes , str )) and string in { "True" , "False" }
214214 )
215215
216216
@@ -570,7 +570,7 @@ def _normalize_tabular_data(tabular_data, headers, showindex="default"):
570570 # values is a property, has .index => it's likely a pandas.DataFrame (pandas 0.11.0)
571571 keys = list (tabular_data )
572572 if (
573- showindex in [ "default" , "always" , True ]
573+ showindex in { "default" , "always" , True }
574574 and tabular_data .index .name is not None
575575 ):
576576 if isinstance (tabular_data .index .name , list ):
@@ -686,7 +686,7 @@ def _normalize_tabular_data(tabular_data, headers, showindex="default"):
686686 rows = list (map (lambda r : r if _is_separating_line (r ) else list (r ), rows ))
687687
688688 # add or remove an index column
689- showindex_is_a_str = type (showindex ) in [ str , bytes ]
689+ showindex_is_a_str = type (showindex ) in { str , bytes }
690690 if showindex == "never" or (not _bool (showindex ) and not showindex_is_a_str ):
691691 pass
692692
@@ -820,7 +820,7 @@ def tabulate(
820820 if colglobalalign is not None : # if global alignment provided
821821 aligns = [colglobalalign ] * len (cols )
822822 else : # default
823- aligns = [numalign if ct in [ int , float ] else stralign for ct in coltypes ]
823+ aligns = [numalign if ct in { int , float } else stralign for ct in coltypes ]
824824 # then specific alignments
825825 if colalign is not None :
826826 assert isinstance (colalign , Iterable )
@@ -1044,4 +1044,4 @@ def _format_table(
10441044 output = "\n " .join (lines )
10451045 return output
10461046 else : # a completely empty table
1047- return ""
1047+ return ""
0 commit comments