def __init__(self, obj=None, default=None, white_list=None, white_pattern=None, black_list=None, ignore_help=False, ignore_return=False, name=None, doc=None, debug=False):

        obj = obj or sys.modules['__main__']
        self.obj = obj

        if hasattr(obj, 'items'):
            obj_items = obj.items()
        else:
            obj_items = inspect.getmembers(obj)

        if not white_list and hasattr(obj, '__all__'):
            white_list = obj.__all__

        tests = (inspect.isbuiltin, inspect.isfunction, inspect.ismethod)

        self.command_funcs = {}
        for obj_name, obj in obj_items:

            if obj_name.startswith('_'): continue
            if not any(test(obj) for test in tests): continue
            if white_list is not None and obj_name not in white_list: continue
            if black_list is not None and obj_name in black_list: continue

            if white_pattern:
                match = white_pattern.match(obj_name)
                if not match: continue
                obj_name = match.group('name')

            self.command_funcs[obj_name] = obj

        self.default = default
        if len(self.command_funcs) == 1:
            self.default = list(self.command_funcs.keys())[0]

        self.ignore_help = ignore_help
        self.ignore_return = ignore_return
        self.name = name or basename(sys.argv[0])
        self.doc = doc
        self.debug = debug
dataset/ETHPy150Open moskytw/clime/clime/core.py/Program.__init__/original