Skip to content

Commit f9ea24d

Browse files
committed
Use write_clean for PathPlus.dump_json
1 parent 6246666 commit f9ea24d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

domdf_python_tools/paths.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,13 @@ def open( # type: ignore # noqa A003
523523
else:
524524
newline = "\n"
525525

526-
return super().open( # type: ignore
527-
mode,
528-
buffering=buffering,
529-
encoding=encoding,
530-
errors=errors,
531-
newline=newline,
532-
)
526+
return super().open( # type: ignore # yapf: disable
527+
mode,
528+
buffering=buffering,
529+
encoding=encoding,
530+
errors=errors,
531+
newline=newline,
532+
)
533533

534534
def dump_json(
535535
self,
@@ -538,7 +538,7 @@ def dump_json(
538538
errors: Optional[str] = None,
539539
json_library: JsonLibrary = json, # type: ignore
540540
**kwargs,
541-
) -> int:
541+
) -> None:
542542
"""
543543
Dump ``data`` to the file as JSON.
544544
@@ -550,9 +550,15 @@ def dump_json(
550550
:param kwargs: Keyword arguments to pass to the JSON serialisation function.
551551
552552
.. versionadded:: 0.5.0
553+
554+
.. versionchanged:: 1.0.0
555+
556+
Now uses :meth:`PathPlus.write_clean <domdf_python_tools.paths.PathPlus.write_clean>`
557+
rather than :meth:`PathPlus.write_text <domdf_python_tools.paths.PathPlus.write_text>`,
558+
and returns :py:obj:`None` rather than :class:`int`.
553559
"""
554560

555-
return self.write_text(
561+
return self.write_clean(
556562
json_library.dumps(data, **kwargs),
557563
encoding=encoding,
558564
errors=errors,

0 commit comments

Comments
 (0)