
"""Helper binary to reencode a text file from UTF-8 to ISO-8859-1."""

import argparse
import pathlib

def _main() -> None:
    parser = argparse.ArgumentParser(allow_abbrev=False)
    parser.add_argument('input', type=pathlib.Path)
    parser.add_argument('output', type=pathlib.Path)
    opts = parser.parse_args()
    text = opts.input.read_text(encoding='utf-8')
    with opts.output.open(mode='xt', encoding='latin-1', newline='\n') as file:
        file.write(text)

if __name__ == '__main__':
    _main()


"""Helper binary to reencode a text file from UTF-8 to ISO-8859-1."""

import argparse
import pathlib

def _main() -> None:
    parser = argparse.ArgumentParser(allow_abbrev=False)
    parser.add_argument('input', type=pathlib.Path)
    parser.add_argument('output', type=pathlib.Path)
    opts = parser.parse_args()
    text = opts.input.read_text(encoding='utf-8')
    # Force Unix-style line endings for consistent results.  See
    # https://github.com/bazelbuild/stardoc/issues/110.
    with opts.output.open(mode='xt', encoding='latin-1', newline='\n') as file:
        file.write(text)

if __name__ == '__main__':
    _main()

Add a comment about line endings in Stardoc files.
Add a comment about line endings in Stardoc files.

  
  """Helper binary to reencode a text file from UTF-8 to ISO-8859-1."""
  
  import argparse
  import pathlib
  
  def _main() -> None:
      parser = argparse.ArgumentParser(allow_abbrev=False)
      parser.add_argument('input', type=pathlib.Path)
      parser.add_argument('output', type=pathlib.Path)
      opts = parser.parse_args()
      text = opts.input.read_text(encoding='utf-8')
+     # Force Unix-style line endings for consistent results.  See
+     # https://github.com/bazelbuild/stardoc/issues/110.
      with opts.output.open(mode='xt', encoding='latin-1', newline='\n') as file:
          file.write(text)
  
  if __name__ == '__main__':
      _main()
  
Add a comment about line endings in Stardoc files.
## Code Before:

"""Helper binary to reencode a text file from UTF-8 to ISO-8859-1."""

import argparse
import pathlib

def _main() -> None:
    parser = argparse.ArgumentParser(allow_abbrev=False)
    parser.add_argument('input', type=pathlib.Path)
    parser.add_argument('output', type=pathlib.Path)
    opts = parser.parse_args()
    text = opts.input.read_text(encoding='utf-8')
    with opts.output.open(mode='xt', encoding='latin-1', newline='\n') as file:
        file.write(text)

if __name__ == '__main__':
    _main()

## Instruction:
Add a comment about line endings in Stardoc files.
## Code After:

"""Helper binary to reencode a text file from UTF-8 to ISO-8859-1."""

import argparse
import pathlib

def _main() -> None:
    parser = argparse.ArgumentParser(allow_abbrev=False)
    parser.add_argument('input', type=pathlib.Path)
    parser.add_argument('output', type=pathlib.Path)
    opts = parser.parse_args()
    text = opts.input.read_text(encoding='utf-8')
    # Force Unix-style line endings for consistent results.  See
    # https://github.com/bazelbuild/stardoc/issues/110.
    with opts.output.open(mode='xt', encoding='latin-1', newline='\n') as file:
        file.write(text)

if __name__ == '__main__':
    _main()
