| # Copyright 2022 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Provides utility for formatting whitespace.""" |
| from typing import Optional, Union |
| # pylint: disable=unused-argument |
| path: Optional[Union[str, os.PathLike]] = None, |
| """Clean up basic whitespace problems in |data|. |
| data: The file content to lint. |
| path: The file name for diagnostics/configs/etc... |
| # Remove all leading/trailing newlines. |
| # Remove trailing whitespace on all lines. |
| data = "\n".join(x.rstrip() for x in data.splitlines()) |