original_docstring: Open a LeetCode solution contains this filename.
docstring: Open a LeetCode solution contains this filename.
docstring_tokens: Open a LeetCode solution contains this filename .
code: def open_file(args):
      """Open a LeetCode solution contains this filename."""
      searchname = args.filename
      names = []
      paths = []
      for root, dirs, files in os.walk(BASE_DIR):
          for name in files:
              if searchname.lower() in name.lower():
                  names.append(name)
                  paths.append(os.path.join(root, name))
      if len(names) == 0:
          print("Cannot search any solution contains {}.".format(searchname))
          return
      for i in range(len(names)):
          print("{}. {}".format(i, names[i]))
      num = int(input("Please choose one to open:\n"))
      subprocess.call(["open", paths[num]])
code_tokens: def open_file ( args ) : searchname = args . filename names = [ ] paths = [ ] for root , dirs , files in os . walk ( BASE_DIR ) : for name in files : if searchname . lower ( ) in name . lower ( ) : names . append ( name ) paths . append ( os . path . join ( root , name ) ) if len ( names ) == 0 : print ( "Cannot search any solution contains {}." . format ( searchname ) ) return for i in range ( len ( names ) ) : print ( "{}. {}" . format ( i , names [ i ] ) ) num = int ( input ( "Please choose one to open:\n" ) ) subprocess . call ( [ "open" , paths [ num ] ] )
short_docstring: Open a LeetCode solution contains this filename.
short_docstring_tokens: Open a LeetCode solution contains this filename .
comment: """Open a LeetCode solution contains this filename."""