Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix magic comma and experimental string cache flags #2131

Merged
merged 4 commits into from Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
@@ -1,5 +1,11 @@
## Change Log

### Unreleased

- Reflect the `--skip-magic-trailing-comma` and `--experimental-string-processing` flags
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved
in the name of the cache file. Without this fix, changes in these flags would not take
effect if the cache had already been populated. (#2131)

### 21.4b0

#### _Black_
Expand Down
4 changes: 3 additions & 1 deletion src/black/__init__.py
Expand Up @@ -273,9 +273,9 @@ class Mode:
target_versions: Set[TargetVersion] = field(default_factory=set)
line_length: int = DEFAULT_LINE_LENGTH
string_normalization: bool = True
is_pyi: bool = False
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made them the same order as they appear in the cache file name for ease of understanding.

magic_trailing_comma: bool = True
experimental_string_processing: bool = False
is_pyi: bool = False

def get_cache_key(self) -> str:
if self.target_versions:
Expand All @@ -290,6 +290,8 @@ def get_cache_key(self) -> str:
str(self.line_length),
str(int(self.string_normalization)),
str(int(self.is_pyi)),
str(int(self.magic_trailing_comma)),
str(int(self.experimental_string_processing)),
]
return ".".join(parts)

Expand Down