mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Maintain scalar quoting style when autoupdate re-writes rev
If rev is wrapped in single or double quotes (e.g. due to a yamllint quoted-strings rule), when re-writing the rev to update it, honour the existing quotation style
This commit is contained in:
parent
f455312944
commit
98d8a3d60f
3 changed files with 29 additions and 6 deletions
|
|
@ -36,10 +36,11 @@ yaml_load = functools.partial(yaml.load, Loader=Loader)
|
|||
Dumper = getattr(yaml, 'CSafeDumper', yaml.SafeDumper)
|
||||
|
||||
|
||||
def yaml_dump(o: Any) -> str:
|
||||
def yaml_dump(o: Any, **kwargs: Any) -> str:
|
||||
# when python/mypy#1484 is solved, this can be `functools.partial`
|
||||
return yaml.dump(
|
||||
o, Dumper=Dumper, default_flow_style=False, indent=4, sort_keys=False,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue