From 92a150d9e45379ea8c14e1b10293d659f60eb132 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Wed, 6 Jun 2018 11:58:36 -0700 Subject: [PATCH 1/1] Fix improper unmodified file caching when `-S` was used This will also future-proof the cache to changes to FileMode. --- README.md | 5 +++++ black.py | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdc000a..00179a9 100644 --- a/README.md +++ b/README.md @@ -712,6 +712,11 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). ## Change Log +### 18.6b2 + +* fixed improper unmodified file caching when `-S` was used + + ### 18.6b1 * hotfix: don't output human-facing information on stdout (#299) diff --git a/black.py b/black.py index e72db2b..80401f5 100644 --- a/black.py +++ b/black.py @@ -3335,12 +3335,7 @@ def can_omit_invisible_parens(line: Line, line_length: int) -> bool: def get_cache_file(line_length: int, mode: FileMode) -> Path: - pyi = bool(mode & FileMode.PYI) - py36 = bool(mode & FileMode.PYTHON36) - return ( - CACHE_DIR - / f"cache.{line_length}{'.pyi' if pyi else ''}{'.py36' if py36 else ''}.pickle" - ) + return CACHE_DIR / f"cache.{line_length}.{mode.value}.pickle" def read_cache(line_length: int, mode: FileMode) -> Cache: -- 2.39.5