Skip to content

Commit

Permalink
Add etc. handling to the soplitter
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Mar 13, 2022
1 parent 386a43f commit e0e6ffb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pydocstringformatter/formatting/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class SplitSummaryAndDocstringFormatter(StringAndQuotesFormatter):

end_of_sentence_period = re.compile(
r"""
(?<!e.g|i.e) # Not preceded by 'e.g', 'i.e'
(?<!e.g|i.e|etc) # Not preceded by 'e.g', 'i.e', 'etc'
\. # A dot
(?!\w) # Not followed by a letter
""",
Expand Down
7 changes: 7 additions & 0 deletions tests/data/format/summary_splitter/dots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ def func():

def func():
"""We should not split for i.e. here."""


def func():
"""We should not add line after i.e., sys.path, e.g., etc. but etc. in particular
is harder right ?
"""
13 changes: 8 additions & 5 deletions tests/data/format/summary_splitter/dots.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ def func():
"""We should not add extra lines after the dot
to it.
"""
def func():
"""We should not add line after i.e., sys.path, e.g., etc. but etc. in particular

is harder right ?
"""


def func():
"""We should not split for e.g. here."""


def func():
"""We should not split for i.e. here."""


def func():
"""We should not add line after i.e., sys.path, e.g., etc. but etc. in particular.

is harder right ?
"""

0 comments on commit e0e6ffb

Please sign in to comment.