From 04056ff3a59fcfb274d15ac1c6cb27967ddc31ce Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Tue, 30 Jul 2024 23:21:50 +0900 Subject: [PATCH 01/11] Fix manual to state denominator positivity of Fraction --- Doc/library/fractions.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index 2ee154952549ac..b1f4b73305bac3 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -125,8 +125,7 @@ another rational number, or from a string. .. attribute:: denominator - Denominator of the Fraction in lowest term. - + Denominator of the Fraction in lowest term. It is always positive. .. method:: as_integer_ratio() From e5a46088c9ed65c013fa27b732829509cdd96e18 Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Wed, 31 Jul 2024 20:57:16 +0900 Subject: [PATCH 02/11] Update Doc/library/fractions.rst Co-authored-by: Sergey B Kirpichev --- Doc/library/fractions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index b1f4b73305bac3..efad8dca40cda3 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -125,7 +125,7 @@ another rational number, or from a string. .. attribute:: denominator - Denominator of the Fraction in lowest term. It is always positive. + Denominator of the Fraction in lowest terms and positive. .. method:: as_integer_ratio() From 05c764d9784dd8e973c950ec7d9b3e4b431bd117 Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Wed, 31 Jul 2024 21:01:45 +0900 Subject: [PATCH 03/11] Add docstrings to numerator and denominator of Fraction --- Lib/fractions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/fractions.py b/Lib/fractions.py index 34fd0803d1b1ab..bb65de8d68370c 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -413,10 +413,12 @@ def limit_denominator(self, max_denominator=1000000): @property def numerator(a): + """Numerator in lowest terms.""" return a._numerator @property def denominator(a): + """Denominator in lowest terms and positive.""" return a._denominator def __repr__(self): From ad66afb189951a8de9f15a186cbc31e09e9f90da Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Wed, 31 Jul 2024 21:03:01 +0900 Subject: [PATCH 04/11] Correct a word --- Doc/library/fractions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index efad8dca40cda3..b7bc0fd61a572c 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -121,7 +121,7 @@ another rational number, or from a string. .. attribute:: numerator - Numerator of the Fraction in lowest term. + Numerator of the Fraction in lowest terms. .. attribute:: denominator From 416b9cd3a7688b149f942a29f69f3808d71a6b27 Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Wed, 31 Jul 2024 21:57:16 +0900 Subject: [PATCH 05/11] Update Lib/fractions.py Co-authored-by: Sergey B Kirpichev --- Lib/fractions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index bb65de8d68370c..afae67b35c0972 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -418,7 +418,7 @@ def numerator(a): @property def denominator(a): - """Denominator in lowest terms and positive.""" + """The denominator of a rational number in lowest terms.""" return a._denominator def __repr__(self): From 7cb190553f7246d5e4f910cf0b9203e902694ea7 Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Wed, 31 Jul 2024 21:57:31 +0900 Subject: [PATCH 06/11] Update Lib/fractions.py Co-authored-by: Sergey B Kirpichev --- Lib/fractions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index afae67b35c0972..dcf24ab281835d 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -413,7 +413,7 @@ def limit_denominator(self, max_denominator=1000000): @property def numerator(a): - """Numerator in lowest terms.""" + """The numerator of a rational number in lowest terms.""" return a._numerator @property From ddec59c12bb76ef03b845c6fb7d147609f8815ba Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Thu, 1 Aug 2024 23:06:16 +0900 Subject: [PATCH 07/11] Update Lib/fractions.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Lib/fractions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index dcf24ab281835d..7916fde0adade8 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -418,7 +418,7 @@ def numerator(a): @property def denominator(a): - """The denominator of a rational number in lowest terms.""" + """The (positive) denominator of a rational number in lowest terms.""" return a._denominator def __repr__(self): From ed48fb7a9059723335b7a5d853d40853386de1ec Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Thu, 1 Aug 2024 23:06:54 +0900 Subject: [PATCH 08/11] Update Doc/library/fractions.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/fractions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index b7bc0fd61a572c..a5f9633fe04817 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -125,7 +125,7 @@ another rational number, or from a string. .. attribute:: denominator - Denominator of the Fraction in lowest terms and positive. + Positive denominator of the Fraction in lowest terms. .. method:: as_integer_ratio() From c575b470edb8ccf0928f5ec9fcf236c9ea435bb3 Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Thu, 1 Aug 2024 23:08:43 +0900 Subject: [PATCH 09/11] Add docstrings to numerator and denominator of Rational --- Lib/numbers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/numbers.py b/Lib/numbers.py index a2913e32cfada7..8b2e8dfaa551ca 100644 --- a/Lib/numbers.py +++ b/Lib/numbers.py @@ -297,11 +297,13 @@ class Rational(Real): @property @abstractmethod def numerator(self): + """The numerator of a rational number in lowest terms.""" raise NotImplementedError @property @abstractmethod def denominator(self): + """The (positive) denominator of a rational number in lowest terms.""" raise NotImplementedError # Concrete implementation of Real's conversion to float. From a531cb6df03818e50c13973f9b33f5c1482a5cdc Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Fri, 2 Aug 2024 11:58:14 +0900 Subject: [PATCH 10/11] Update Lib/fractions.py Co-authored-by: Sergey B Kirpichev --- Lib/fractions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index 7916fde0adade8..0b001a3f779586 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -413,7 +413,6 @@ def limit_denominator(self, max_denominator=1000000): @property def numerator(a): - """The numerator of a rational number in lowest terms.""" return a._numerator @property From 1f2519acb9bffa57f9944a0cf209404be191a92a Mon Sep 17 00:00:00 2001 From: Hugo Sansaqua Date: Fri, 2 Aug 2024 11:58:20 +0900 Subject: [PATCH 11/11] Update Lib/fractions.py Co-authored-by: Sergey B Kirpichev --- Lib/fractions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index 0b001a3f779586..34fd0803d1b1ab 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -417,7 +417,6 @@ def numerator(a): @property def denominator(a): - """The (positive) denominator of a rational number in lowest terms.""" return a._denominator def __repr__(self):