AUTO_DETECT = 0
PYTHON36 = 1
PYI = 2
+ NO_STRING_NORMALIZATION = 4
@click.command()
"**kwargs. [default: per-file auto-detection]"
),
)
+@click.option(
+ "-S",
+ "--skip-string-normalization",
+ is_flag=True,
+ help="Don't normalize string quotes or prefixes.",
+)
@click.version_option(version=__version__)
@click.argument(
"src",
fast: bool,
pyi: bool,
py36: bool,
+ skip_string_normalization: bool,
quiet: bool,
src: List[str],
) -> None:
mode |= FileMode.PYTHON36
if pyi:
mode |= FileMode.PYI
+ if skip_string_normalization:
+ mode |= FileMode.NO_STRING_NORMALIZATION
report = Report(check=check, quiet=quiet)
if len(sources) == 0:
out("No paths given. Nothing to do 😴")
future_imports = get_future_imports(src_node)
is_pyi = bool(mode & FileMode.PYI)
py36 = bool(mode & FileMode.PYTHON36) or is_python36(src_node)
+ normalize_strings = not bool(mode & FileMode.NO_STRING_NORMALIZATION)
lines = LineGenerator(
- remove_u_prefix=py36 or "unicode_literals" in future_imports, is_pyi=is_pyi
+ remove_u_prefix=py36 or "unicode_literals" in future_imports,
+ is_pyi=is_pyi,
+ normalize_strings=normalize_strings,
)
elt = EmptyLineTracker(is_pyi=is_pyi)
empty_line = Line()
"""
is_pyi: bool = False
+ normalize_strings: bool = True
current_line: Line = Factory(Line)
remove_u_prefix: bool = False
else:
normalize_prefix(node, inside_brackets=any_open_brackets)
- if node.type == token.STRING:
+ if self.normalize_strings and node.type == token.STRING:
normalize_string_prefix(node, remove_u_prefix=self.remove_u_prefix)
normalize_string_quotes(node)
if node.type not in WHITESPACE: