-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
black: add a single-quotes option to prefer single quotes
Add support for `black -s|--single-quotes`. Fixes #594
- Loading branch information
Showing
6 changed files
with
145 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
'''''' | ||
'\'' | ||
'"' | ||
"'" | ||
"\"" | ||
"Hello" | ||
"Don't do that" | ||
'Here is a "' | ||
'What\'s the deal here?' | ||
"What's the deal \"here\"?" | ||
"And \"here\"?" | ||
"""Strings with "" in them""" | ||
'''Strings with "" in them''' | ||
'''Here's a "''' | ||
'''Here's a " ''' | ||
'''Just a normal triple | ||
quote''' | ||
f"just a normal {f} string" | ||
f'''This is a triple-quoted {f}-string''' | ||
f'MOAR {" ".join([])}' | ||
f"MOAR {' '.join([])}" | ||
r"raw string ftw" | ||
r'Date d\'expiration:(.*)' | ||
r'Tricky "quote' | ||
r'Not-so-tricky \"quote' | ||
r'Not-so-tricky \'single-quote' | ||
rf'{yay}' | ||
'\n\ | ||
The \"quick\"\n\ | ||
brown fox\n\ | ||
jumps over\n\ | ||
the \'lazy\' dog.\n\ | ||
' | ||
re.compile(r'[\\"]') | ||
"x = ''; y = \"\"" | ||
"x = '''; y = \"\"" | ||
"x = ''''; y = \"\"" | ||
"x = '' ''; y = \"\"" | ||
"x = ''; y = \"\"\"" | ||
"x = '''; y = \"\"\"\"" | ||
"x = ''''; y = \"\"\"\"\"" | ||
"x = '' ''; y = \"\"\"\"\"" | ||
'unnecessary \"\"escaping' | ||
"unnecessary \'\'escaping" | ||
'\\""' | ||
"\\''" | ||
'Lots of \\\\\\\\\'quotes\'' | ||
|
||
# output | ||
|
||
"""""" | ||
"'" | ||
'"' | ||
"'" | ||
'"' | ||
'Hello' | ||
"Don't do that" | ||
'Here is a "' | ||
"What's the deal here?" | ||
'What\'s the deal "here"?' | ||
'And "here"?' | ||
"""Strings with "" in them""" | ||
"""Strings with "" in them""" | ||
'''Here's a "''' | ||
"""Here's a " """ | ||
"""Just a normal triple | ||
quote""" | ||
f'just a normal {f} string' | ||
f"""This is a triple-quoted {f}-string""" | ||
f'MOAR {" ".join([])}' | ||
f"MOAR {' '.join([])}" | ||
r'raw string ftw' | ||
r'Date d\'expiration:(.*)' | ||
r'Tricky "quote' | ||
r'Not-so-tricky \"quote' | ||
r'Not-so-tricky \'single-quote' | ||
rf'{yay}' | ||
'\n\ | ||
The "quick"\n\ | ||
brown fox\n\ | ||
jumps over\n\ | ||
the \'lazy\' dog.\n\ | ||
' | ||
re.compile(r'[\\"]') | ||
'x = \'\'; y = ""' | ||
"x = '''; y = \"\"" | ||
"x = ''''; y = \"\"" | ||
"x = '' ''; y = \"\"" | ||
'x = \'\'; y = """' | ||
'x = \'\'\'; y = """"' | ||
'x = \'\'\'\'; y = """""' | ||
'x = \'\' \'\'; y = """""' | ||
'unnecessary ""escaping' | ||
"unnecessary ''escaping" | ||
'\\""' | ||
"\\''" | ||
"Lots of \\\\\\\\'quotes'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters