2323import inspect
2424
2525from fire import inspectutils
26- import six
2726
2827
2928def Script (name , component , default_options = None , shell = 'bash' ):
@@ -104,7 +103,7 @@ def _BashScript(name, commands, default_options=None):
104103option_already_entered()
105104{{
106105 local opt
107- for opt in ${{COMP_WORDS[@]:0:COMP_CWORD}}
106+ for opt in ${{COMP_WORDS[@]:0:$ COMP_CWORD}}
108107 do
109108 if [ $1 == $opt ]; then
110109 return 0
@@ -278,10 +277,7 @@ def _FishScript(name, commands, default_options=None):
278277 )
279278
280279 return fish_source .format (
281- global_options = ' ' .join (
282- '"{option}"' .format (option = option )
283- for option in global_options
284- )
280+ global_options = ' ' .join (f'"{ option } "' for option in global_options )
285281 )
286282
287283
@@ -308,23 +304,24 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False):
308304 Returns
309305 A boolean value indicating whether the member should be included.
310306 """
311- if isinstance (name , six . string_types ) and name .startswith ('__' ):
307+ if isinstance (name , str ) and name .startswith ('__' ):
312308 return False
313309 if verbose :
314310 return True
315311 if (member is absolute_import
316312 or member is division
317313 or member is print_function ):
318314 return False
319- if isinstance (member , type (absolute_import )) and six . PY34 :
315+ if isinstance (member , type (absolute_import )):
320316 return False
321- if inspect .ismodule (member ) and member is six :
322- # TODO(dbieber): Determine more generally which modules to hide.
317+ # TODO(dbieber): Determine more generally which modules to hide.
318+ modules_to_hide = []
319+ if inspect .ismodule (member ) and member in modules_to_hide :
323320 return False
324321 if inspect .isclass (component ):
325322 # If class_attrs has not been provided, compute it.
326323 if class_attrs is None :
327- class_attrs = inspectutils .GetClassAttrsDict (class_attrs ) or {}
324+ class_attrs = inspectutils .GetClassAttrsDict (component ) or {}
328325 class_attr = class_attrs .get (name )
329326 if class_attr :
330327 # Methods and properties should only be accessible on instantiated
@@ -336,14 +333,7 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False):
336333 tuplegetter = getattr (collections , '_tuplegetter' , type (None ))
337334 if isinstance (class_attr .object , tuplegetter ):
338335 return False
339- if (six .PY2 and inspect .isfunction (component )
340- and name in ('func_closure' , 'func_code' , 'func_defaults' ,
341- 'func_dict' , 'func_doc' , 'func_globals' , 'func_name' )):
342- return False
343- if (six .PY2 and inspect .ismethod (component )
344- and name in ('im_class' , 'im_func' , 'im_self' )):
345- return False
346- if isinstance (name , six .string_types ):
336+ if isinstance (name , str ):
347337 return not name .startswith ('_' )
348338 return True # Default to including the member
349339
@@ -392,7 +382,7 @@ def _CompletionsFromArgs(fn_args):
392382 completions = []
393383 for arg in fn_args :
394384 arg = arg .replace ('_' , '-' )
395- completions .append ('--{arg}' . format ( arg = arg ) )
385+ completions .append (f '--{ arg } ' )
396386 return completions
397387
398388
@@ -438,7 +428,7 @@ def _FormatForCommand(token):
438428 Returns:
439429 The transformed token.
440430 """
441- if not isinstance (token , six . string_types ):
431+ if not isinstance (token , str ):
442432 token = str (token )
443433
444434 if token .startswith ('_' ):
0 commit comments