
* Normalize string quotes Convert single-quoted strings to double-quoted. Convert triple single-quoted strings to triple double-quoted. Do not touch any strings where conversion would increase the number of backslashes. Fixes #51. * reformat Black itself
38 lines
745 B
Python
38 lines
745 B
Python
"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"
|
|
|
|
# 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"
|