From 486a5a26b2c4d2078ef7d585d06c6e8bb678892b Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 6 Nov 2023 11:38:01 -0800 Subject: [PATCH] Format '.pyi' type stub files. Closes #1151 --- CHANGELOG.md | 1 + yapf/yapflib/file_resources.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca880fb0e..a70d29677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Changes - Remove dependency on importlib-metadata - Remove dependency on tomli when using >= py311 +- Format '.pyi' type sub files. ### Fixed - Fix SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED for one-item named argument lists by taking precedence over SPLIT_BEFORE_NAMED_ASSIGNS. diff --git a/yapf/yapflib/file_resources.py b/yapf/yapflib/file_resources.py index 66ab707ac..87b6d863b 100644 --- a/yapf/yapflib/file_resources.py +++ b/yapf/yapflib/file_resources.py @@ -252,7 +252,7 @@ def IsIgnored(path, exclude): def IsPythonFile(filename): """Return True if filename is a Python file.""" - if os.path.splitext(filename)[1] == '.py': + if os.path.splitext(filename)[1] in frozenset({'.py', '.pyi'}): return True try: