From 004aa99bc17b4e3ff752c368a0a440e950507974 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 10 Feb 2022 19:43:36 +0100 Subject: [PATCH] Add ':' and ';' to allowed punctuation --- pydocstringformatter/formatting/formatter.py | 2 +- .../data/format/final_period/exotic_line_ending.py | 11 +++++++++++ .../format/final_period/exotic_line_ending.py.out | 13 +++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/data/format/final_period/exotic_line_ending.py create mode 100644 tests/data/format/final_period/exotic_line_ending.py.out diff --git a/pydocstringformatter/formatting/formatter.py b/pydocstringformatter/formatting/formatter.py index b576dbb2..f9f0f0a5 100644 --- a/pydocstringformatter/formatting/formatter.py +++ b/pydocstringformatter/formatting/formatter.py @@ -65,7 +65,7 @@ class FinalPeriodFormatter(StringAndQuotesFormatter): """Add a period to the end of single line docstrings and summaries.""" name = "final-period" - END_OF_SENTENCE_PUNCTUATION = {".", "?", "!", "‽"} + END_OF_SENTENCE_PUNCTUATION = {".", "?", "!", "‽", ":", ";"} def _treat_string( self, diff --git a/tests/data/format/final_period/exotic_line_ending.py b/tests/data/format/final_period/exotic_line_ending.py new file mode 100644 index 00000000..ed87a587 --- /dev/null +++ b/tests/data/format/final_period/exotic_line_ending.py @@ -0,0 +1,11 @@ +def function(): + """Check the name of first argument, expect: + + *'self' for a regular method + *'cls' for a class method or a metaclass regular method""" + +def function(): + """This has peculiar line ending; + + but it should not matter. + """ diff --git a/tests/data/format/final_period/exotic_line_ending.py.out b/tests/data/format/final_period/exotic_line_ending.py.out new file mode 100644 index 00000000..302b9cd7 --- /dev/null +++ b/tests/data/format/final_period/exotic_line_ending.py.out @@ -0,0 +1,13 @@ +def function(): + """Check the name of first argument, expect: + + *'self' for a regular method + *'cls' for a class method or a metaclass regular method + """ + +def function(): + """This has peculiar line ending; + + but it should not matter. + + """