
from utilities import get_pv_names, write_pvs_to_file
import argparse

parser = argparse.ArgumentParser('optional named arguments')
parser.add_argument("-f", "--file", dest="filename",
                    help="write report to FILE", metavar="FILE", default = 'test.txt')

requiredArgv = parser.add_argument_group('required arguments')
requiredArgv.add_argument("-m", "--mode", dest="mode",
                          help="Machine MODE to use", metavar="MODE", required = True)

argv = parser.parse_args()


mode_pvs = get_pv_names(argv.mode)
write_pvs_to_file(argv.filename, mode_pvs)

print argv.filename


from utilities import get_pv_names, write_pvs_to_file
import argparse

parser = argparse.ArgumentParser('optional named arguments')
parser.add_argument("-f", "--file", dest="filename",
                    help="write report to FILE", metavar="FILE", default = 'test.txt')

requiredArgv = parser.add_argument_group('required arguments')
requiredArgv.add_argument("-m", "--mode", dest="mode",
                          help="Machine MODE to use", metavar="MODE", required = True)

argv = parser.parse_args()


mode_pvs = get_pv_names(argv.mode)
# File appears to be already sorted, so no need for next line
# sorted(mode_pvs)
write_pvs_to_file(argv.filename, mode_pvs)

Clear unnecessary code, add comments on sorting
Clear unnecessary code, add comments on sorting

  
  from utilities import get_pv_names, write_pvs_to_file
  import argparse
  
  parser = argparse.ArgumentParser('optional named arguments')
  parser.add_argument("-f", "--file", dest="filename",
                      help="write report to FILE", metavar="FILE", default = 'test.txt')
  
  requiredArgv = parser.add_argument_group('required arguments')
  requiredArgv.add_argument("-m", "--mode", dest="mode",
                            help="Machine MODE to use", metavar="MODE", required = True)
  
  argv = parser.parse_args()
  
  
  mode_pvs = get_pv_names(argv.mode)
+ # File appears to be already sorted, so no need for next line
+ # sorted(mode_pvs)
  write_pvs_to_file(argv.filename, mode_pvs)
  
- print argv.filename
- 
Clear unnecessary code, add comments on sorting
## Code Before:

from utilities import get_pv_names, write_pvs_to_file
import argparse

parser = argparse.ArgumentParser('optional named arguments')
parser.add_argument("-f", "--file", dest="filename",
                    help="write report to FILE", metavar="FILE", default = 'test.txt')

requiredArgv = parser.add_argument_group('required arguments')
requiredArgv.add_argument("-m", "--mode", dest="mode",
                          help="Machine MODE to use", metavar="MODE", required = True)

argv = parser.parse_args()


mode_pvs = get_pv_names(argv.mode)
write_pvs_to_file(argv.filename, mode_pvs)

print argv.filename

## Instruction:
Clear unnecessary code, add comments on sorting
## Code After:

from utilities import get_pv_names, write_pvs_to_file
import argparse

parser = argparse.ArgumentParser('optional named arguments')
parser.add_argument("-f", "--file", dest="filename",
                    help="write report to FILE", metavar="FILE", default = 'test.txt')

requiredArgv = parser.add_argument_group('required arguments')
requiredArgv.add_argument("-m", "--mode", dest="mode",
                          help="Machine MODE to use", metavar="MODE", required = True)

argv = parser.parse_args()


mode_pvs = get_pv_names(argv.mode)
# File appears to be already sorted, so no need for next line
# sorted(mode_pvs)
write_pvs_to_file(argv.filename, mode_pvs)
