Skip to content

Commit

Permalink
refactor: Fix typo in function name (python-poetry#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jul 3, 2022
1 parent 2989d5a commit 8686aa0
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 8686aa0

Please sign in to comment.