From d33461a65978b536b99d913c6392ff2c4acf556b Mon Sep 17 00:00:00 2001 From: Doyle Rowland Date: Mon, 12 May 2025 12:48:40 -0400 Subject: [PATCH] fix: update README example The example in the README can't be produced because the 'Launch the rocket.' line gets picked up as a list is unformatted unlike in the example. For now the README will be updated until the list-like detection code is updated. --- README.rst | 18 ++---------------- src/docformatter/syntax.py | 4 +++- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/README.rst b/README.rst index 7ba38c82..03c90244 100644 --- a/README.rst +++ b/README.rst @@ -113,12 +113,6 @@ this code This module docstring should be dedented.""" - def launch_rocket(): - """Launch - the - rocket. Go colonize space.""" - - def factorial(x): ''' @@ -141,7 +135,7 @@ this code function""" print_factorial(5) if factorial(10): - launch_rocket() + print_factorial(22) gets formatted into this @@ -153,14 +147,6 @@ gets formatted into this This module docstring should be dedented. """ - - def launch_rocket(): - """Launch the rocket. - - Go colonize space. - """ - - def factorial(x): """Return x factorial. @@ -179,7 +165,7 @@ gets formatted into this """Main function.""" print_factorial(5) if factorial(10): - launch_rocket() + print_factorial(22) Marketing ========= diff --git a/src/docformatter/syntax.py b/src/docformatter/syntax.py index 4f18dcc6..79b8cb8d 100644 --- a/src/docformatter/syntax.py +++ b/src/docformatter/syntax.py @@ -180,6 +180,7 @@ """ HEURISTIC_MIN_LIST_ASPECT_RATIO = 0.4 +"""The minimum aspect ratio to consider a list.""" def description_to_list( @@ -649,7 +650,8 @@ def is_some_sort_of_list( """ split_lines = text.rstrip().splitlines() - # TODO: Find a better way of doing this. + # TODO: Find a better way of doing this. Conversely, create a logger and log + # potential lists for the user to decide if they are lists or not. # Very large number of lines but short columns probably means a list of # items. if (