

def extract_function_names(module):
    '''
    extract function names from attributes of 'module'.
    '''
    from importlib import import_module

    mod = import_module(module.__name__)
    attr_list = dir(mod)
    scope = locals()

    def iscallable(name):
        return eval('callable(mod.{})'.format(name), scope)

    return filter(iscallable, attr_list)


def gen_pyplot_functions(dub_root):
    '''
    generate 'pyplot_functions.txt' for matplotlibd.pyplot.
    '''
    import matplotlib.pyplot
    from string import lowercase

    functions = filter(lambda i: i[0] != '_' or i[0] in lowercase,
                       extract_function_names(matplotlib.pyplot))

    with open(dub_root + "/views/pyplot_functions.txt", "w") as f:
        f.write("\n".join(functions))


if __name__ == '__main__':
    from sys import argv
    gen_pyplot_functions(argv[1])



def extract_function_names(module):
    '''
    extract function names from attributes of 'module'.
    '''
    from importlib import import_module

    mod = import_module(module.__name__)
    attr_list = dir(mod)
    scope = locals()

    def iscallable(name):
        ignore_decorators = ['dedent','deprecated','silent_list', 'warn_deprecated']
        return eval('callable(mod.{})'.format(name), scope) and name not in ignore_decorators

    return filter(iscallable, attr_list)


def gen_pyplot_functions(dub_root):
    '''
    generate 'pyplot_functions.txt' for matplotlibd.pyplot.
    '''
    import matplotlib.pyplot
    from string import lowercase

    functions = filter(lambda i: i[0] != '_' or i[0] in lowercase,
                       extract_function_names(matplotlib.pyplot))

    with open(dub_root + "/views/pyplot_functions.txt", "w") as f:
        f.write("\n".join(functions))


if __name__ == '__main__':
    from sys import argv
    gen_pyplot_functions(argv[1])

Remove python decorators from list
Remove python decorators from list

  
  
  def extract_function_names(module):
      '''
      extract function names from attributes of 'module'.
      '''
      from importlib import import_module
  
      mod = import_module(module.__name__)
      attr_list = dir(mod)
      scope = locals()
  
      def iscallable(name):
+         ignore_decorators = ['dedent','deprecated','silent_list', 'warn_deprecated']
-         return eval('callable(mod.{})'.format(name), scope)
+         return eval('callable(mod.{})'.format(name), scope) and name not in ignore_decorators
  
      return filter(iscallable, attr_list)
  
  
  def gen_pyplot_functions(dub_root):
      '''
      generate 'pyplot_functions.txt' for matplotlibd.pyplot.
      '''
      import matplotlib.pyplot
      from string import lowercase
  
      functions = filter(lambda i: i[0] != '_' or i[0] in lowercase,
                         extract_function_names(matplotlib.pyplot))
  
      with open(dub_root + "/views/pyplot_functions.txt", "w") as f:
          f.write("\n".join(functions))
  
  
  if __name__ == '__main__':
      from sys import argv
      gen_pyplot_functions(argv[1])
  
Remove python decorators from list
## Code Before:


def extract_function_names(module):
    '''
    extract function names from attributes of 'module'.
    '''
    from importlib import import_module

    mod = import_module(module.__name__)
    attr_list = dir(mod)
    scope = locals()

    def iscallable(name):
        return eval('callable(mod.{})'.format(name), scope)

    return filter(iscallable, attr_list)


def gen_pyplot_functions(dub_root):
    '''
    generate 'pyplot_functions.txt' for matplotlibd.pyplot.
    '''
    import matplotlib.pyplot
    from string import lowercase

    functions = filter(lambda i: i[0] != '_' or i[0] in lowercase,
                       extract_function_names(matplotlib.pyplot))

    with open(dub_root + "/views/pyplot_functions.txt", "w") as f:
        f.write("\n".join(functions))


if __name__ == '__main__':
    from sys import argv
    gen_pyplot_functions(argv[1])

## Instruction:
Remove python decorators from list
## Code After:


def extract_function_names(module):
    '''
    extract function names from attributes of 'module'.
    '''
    from importlib import import_module

    mod = import_module(module.__name__)
    attr_list = dir(mod)
    scope = locals()

    def iscallable(name):
        ignore_decorators = ['dedent','deprecated','silent_list', 'warn_deprecated']
        return eval('callable(mod.{})'.format(name), scope) and name not in ignore_decorators

    return filter(iscallable, attr_list)


def gen_pyplot_functions(dub_root):
    '''
    generate 'pyplot_functions.txt' for matplotlibd.pyplot.
    '''
    import matplotlib.pyplot
    from string import lowercase

    functions = filter(lambda i: i[0] != '_' or i[0] in lowercase,
                       extract_function_names(matplotlib.pyplot))

    with open(dub_root + "/views/pyplot_functions.txt", "w") as f:
        f.write("\n".join(functions))


if __name__ == '__main__':
    from sys import argv
    gen_pyplot_functions(argv[1])
