tools/metrics/histograms/pretty_print.py
def main():
  """Pretty-prints the histograms or enums xml file at given relative path.

  Args:
    filepath: The relative path to xml file.
    --non-interactive: (Optional) Does not print log info messages and does not
        prompt user to accept the diff.
    --presubmit: (Optional) Simply prints a message if the input is not
        formatted correctly instead of modifying the file.
    --diff: (Optional) Prints diff to stdout rather than modifying the file.

  Example usage:
    pretty_print.py metadata/Fingerprint/histograms.xml
    pretty_print.py enums.xml
  """
  parser = argparse.ArgumentParser()
  parser.add_argument('filepath', help="relative path to XML file")
  # The following optional flags are used by common/presubmit_util.py
  parser.add_argument('--non-interactive', action="store_true")
  parser.add_argument('--presubmit', action="store_true")
  parser.add_argument('--diff', action="store_true")
  args = parser.parse_args()

  status = 0
  if 'enums.xml' in args.filepath:
    status = presubmit_util.DoPresubmit(sys.argv, 'enums.xml',
                                        'enums.before.pretty-print.xml',
                                        PrettyPrintEnums)

  elif 'histograms' in args.filepath:
    # Specify the individual directory of histograms.xml or
    # obsolete_histograms.xml.
    status = presubmit_util.DoPresubmit(
        sys.argv,
        args.filepath,
        # The backup filename should be
        # 'path/to/histograms.before.pretty-print.xml'.
        '.before.pretty-print.'.join(args.filepath.rsplit('.', 1)),
        PrettyPrintHistograms)

  sys.exit(status)
Pretty-prints the histograms or enums xml file at given relative path.

  Args:
    filepath: The relative path to xml file.
    --non-interactive: (Optional) Does not print log info messages and does not
        prompt user to accept the diff.
    --presubmit: (Optional) Simply prints a message if the input is not
        formatted correctly instead of modifying the file.
    --diff: (Optional) Prints diff to stdout rather than modifying the file.

  Example usage:
    pretty_print.py metadata/Fingerprint/histograms.xml
    pretty_print.py enums.xml
  
Pretty-prints the histograms or enums xml file at given relative path.
Pretty - prints the histograms or enums xml file at given relative path .
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('filepath', help="relative path to XML file")
  parser.add_argument('--non-interactive', action="store_true")
  parser.add_argument('--presubmit', action="store_true")
  parser.add_argument('--diff', action="store_true")
  args = parser.parse_args()
  status = 0
  if 'enums.xml' in args.filepath:
    status = presubmit_util.DoPresubmit(sys.argv, 'enums.xml',
                                        'enums.before.pretty-print.xml',
                                        PrettyPrintEnums)
  elif 'histograms' in args.filepath:
    status = presubmit_util.DoPresubmit(
        sys.argv,
        args.filepath,
        '.before.pretty-print.'.join(args.filepath.rsplit('.', 1)),
        PrettyPrintHistograms)
  sys.exit(status)
def main ( ) : parser = argparse . ArgumentParser ( ) parser . add_argument ( 'filepath' , help = "relative path to XML file" ) parser . add_argument ( '--non-interactive' , action = "store_true" ) parser . add_argument ( '--presubmit' , action = "store_true" ) parser . add_argument ( '--diff' , action = "store_true" ) args = parser . parse_args ( ) status = 0 if 'enums.xml' in args . filepath : status = presubmit_util . DoPresubmit ( sys . argv , 'enums.xml' , 'enums.before.pretty-print.xml' , PrettyPrintEnums ) elif 'histograms' in args . filepath : status = presubmit_util . DoPresubmit ( sys . argv , args . filepath , '.before.pretty-print.' . join ( args . filepath . rsplit ( '.' , 1 ) ) , PrettyPrintHistograms ) sys . exit ( status )
Pretty-prints the histograms or enums xml file at given relative path.
Pretty - prints the histograms or enums xml file at given relative path .
"""Pretty-prints the histograms or enums xml file at given relative path.

  Args:
    filepath: The relative path to xml file.
    --non-interactive: (Optional) Does not print log info messages and does not
        prompt user to accept the diff.
    --presubmit: (Optional) Simply prints a message if the input is not
        formatted correctly instead of modifying the file.
    --diff: (Optional) Prints diff to stdout rather than modifying the file.

  Example usage:
    pretty_print.py metadata/Fingerprint/histograms.xml
    pretty_print.py enums.xml
  """ # The following optional flags are used by common/presubmit_util.py # Specify the individual directory of histograms.xml or # obsolete_histograms.xml. # The backup filename should be # 'path/to/histograms.before.pretty-print.xml'.
filepath
The relative path to xml file.
The relative path to xml file .
--non-interactive
(Optional) Does not print log info messages and does not
prompt user to accept the diff.
( Optional ) Does not print log info messages and does not prompt user to accept the diff .
--presubmit
(Optional) Simply prints a message if the input is not
formatted correctly instead of modifying the file.
( Optional ) Simply prints a message if the input is not formatted correctly instead of modifying the file .
--diff
(Optional) Prints diff to stdout rather than modifying the file.
( Optional ) Prints diff to stdout rather than modifying the file .