Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in function name #203

Merged
merged 1 commit into from Jul 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions tomlkit/container.py
Expand Up @@ -192,7 +192,7 @@ def append(self, key: Union[Key, str, None], item: Item) -> "Container":
item.name = key.key

prev = self._previous_item()
prev_ws = isinstance(prev, Whitespace) or ends_with_withespace(prev)
prev_ws = isinstance(prev, Whitespace) or ends_with_whitespace(prev)
if isinstance(item, Table):
if item.name != key.key:
item.invalidate_display_name()
Expand Down Expand Up @@ -310,7 +310,7 @@ def append(self, key: Union[Key, str, None], item: Item) -> "Container":
previous_item = self._body[-1][1]
if not (
isinstance(previous_item, Whitespace)
or ends_with_withespace(previous_item)
or ends_with_whitespace(previous_item)
or is_table
or "\n" in previous_item.trivia.trail
):
Expand Down Expand Up @@ -425,7 +425,7 @@ def _insert_at(self, idx: int, key: Union[Key, str], item: Any) -> "Container":
previous_item = self._body[idx - 1][1]
if not (
isinstance(previous_item, Whitespace)
or ends_with_withespace(previous_item)
or ends_with_whitespace(previous_item)
or isinstance(item, (AoT, Table))
or "\n" in previous_item.trivia.trail
):
Expand Down Expand Up @@ -719,7 +719,7 @@ def _replace_at(
# - it is not the last item
last, _ = self._previous_item_with_index()
idx = last if idx < 0 else idx
has_ws = ends_with_withespace(value)
has_ws = ends_with_whitespace(value)
next_ws = idx < last and isinstance(self._body[idx + 1][1], Whitespace)
if idx < last and not (next_ws or has_ws):
value.append(None, Whitespace("\n"))
Expand Down Expand Up @@ -868,7 +868,7 @@ def setdefault(self, key: Union[Key, str], default: Any) -> Any:
return self[key]


def ends_with_withespace(it: Any) -> bool:
def ends_with_whitespace(it: Any) -> bool:
"""Returns ``True`` if the given item ``it`` is a ``Table`` or ``AoT`` object
ending with a ``Whitespace``.
"""
Expand Down