From 6a1f3d0cf700fc43a6d542195cbeac6c27855d8e Mon Sep 17 00:00:00 2001 From: Madhusudhan Kasula Date: Wed, 10 Jun 2020 18:38:00 +0530 Subject: [PATCH] bpo-40529: rlcompleter with case insensitive Changed func name set_case_insensitive() -> set_ignore_case() Modified Docs and Tests accordingly * skip news --- Doc/library/rlcompleter.rst | 2 +- Lib/rlcompleter.py | 4 ++-- Lib/test/test_rlcompleter.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst index 9662ab965ad..9f1adc3bad7 100644 --- a/Doc/library/rlcompleter.rst +++ b/Doc/library/rlcompleter.rst @@ -69,7 +69,7 @@ Case Sensitivity You can change the Completer's default case sensitive selection to case insensitive using the following method: -.. function:: rlcompleter.set_case_insensitive(option) +.. function:: rlcompleter.set_ignore_case(option) Return the *None*. diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 47ac6579d76..f5c8ea7baa4 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -13,7 +13,7 @@ Tip: to use the tab key as the completion key, call And to make completion with case insensitive, call - rlcompleter.set_case_insensitive(True) + rlcompleter.set_ignore_case(True) Notes: @@ -192,7 +192,7 @@ class Completer: return matches _re_ignorecase_flags = 0 -def set_case_insensitive(option): +def set_ignore_case(option): import re global _re_ignorecase_flags _re_ignorecase_flags = re.IGNORECASE if option else 0 diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py index a4c1c306d21..9c5a841b90e 100644 --- a/Lib/test/test_rlcompleter.py +++ b/Lib/test/test_rlcompleter.py @@ -141,7 +141,7 @@ class TestRlcompleter(unittest.TestCase): # add an additional attr for testing CompleteMe.SpAm = 2 # enable the case insensitive option - rlcompleter.set_case_insensitive(True) + rlcompleter.set_ignore_case(True) # test globals self.assertEqual(self.completer.global_matches('completem'), ['CompleteMe(']) @@ -149,7 +149,7 @@ class TestRlcompleter(unittest.TestCase): self.assertNotEqual(self.completer.attr_matches('CompleteMe.spa'), ['CompleteMe.spam', 'CompleteMe.SpAm']) # disable the case insensitive option - rlcompleter.set_case_insensitive(False) + rlcompleter.set_ignore_case(False) # test globals self.assertNotEqual(self.completer.global_matches('completem'), ['CompleteMe('])