Skip to content

Commit

Permalink
make add_comments private
Browse files Browse the repository at this point in the history
  • Loading branch information
n-takumasa committed Mar 6, 2024
1 parent 2d941f8 commit c9ead2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions jsonc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

import json
import warnings
from json import JSONDecoder, JSONEncoder # for compatibility
from json import JSONDecodeError, JSONDecoder, JSONEncoder
from typing import TYPE_CHECKING

from jsonc._add_comments import add_comments
from jsonc._add_comments import _add_comments
from jsonc._util import _add_trailing_comma, _remove_c_comment, _remove_trailing_comma

if TYPE_CHECKING:
Expand All @@ -28,6 +28,15 @@
from jsonc._add_comments import Comments

__version__ = "0.0.0"
__all__ = [
"dump",
"dumps",
"load",
"loads",
"JSONDecoder",
"JSONDecodeError",
"JSONEncoder",
]


def load(
Expand Down Expand Up @@ -130,7 +139,7 @@ def dumps(
warnings.warn("Can't add comments to non-indented JSON", stacklevel=2)
return data

return add_comments(data, comments)
return _add_comments(data, comments)


def dump(
Expand Down
2 changes: 1 addition & 1 deletion jsonc/_add_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _warn_unused(
)


def add_comments(data: str, comments: Comments) -> str: # noqa: C901
def _add_comments(data: str, comments: Comments) -> str: # noqa: C901
header, cdict = _get_comments({0: copy.deepcopy(comments)}, 0)
header = _make_comment(header) + "\n" if header else ""
result = []
Expand Down

0 comments on commit c9ead2f

Please sign in to comment.