From 6e8ea136444855b0525c5ac916a6f7388c4a82b8 Mon Sep 17 00:00:00 2001 From: xqt Date: Sat, 4 Jan 2025 11:58:36 +0100 Subject: [PATCH] cleanup: remove old deprecation variables - remove deprecated variables which where added in Pywikibot 6.0 and before. A deprecation warning was already thrown. There is a generic warning if they are still used. - remove _future_variables and add content to _deprecated_variables. _future_variables were added with 4.0 for imports from __future__ but they are obsolete with sundown of Python 2. Add them to deprecation warning. - fix deprecation warning Change-Id: Ib0df1ae4ebcd3576afd245eec754462bd4c27f8a --- pywikibot/config.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/pywikibot/config.py b/pywikibot/config.py index cabc17c700..55e1916301 100644 --- a/pywikibot/config.py +++ b/pywikibot/config.py @@ -102,21 +102,14 @@ class _ConfigurationDeprecationWarning(UserWarning): # exported to other modules. _private_values = {'authenticate', 'db_password'} +# _deprecated_variables contains deprecated config variables which are +# no longer used. The values of this dict is the Pywikibot version of +# the deprecation but unused. _deprecated_variables = { - 'available_ssl_project', 'copyright_check_in_source_google', - 'copyright_check_in_source_msn', 'copyright_check_in_source_section_names', - 'copyright_check_in_source_yahoo', 'copyright_connection_tries', - 'copyright_economize_query', 'copyright_exceeded_in_queries', - 'copyright_exceeded_in_queries_sleep_hours', 'copyright_google', - 'copyright_max_query_for_page', 'copyright_msn', 'copyright_show_date', - 'copyright_show_length', 'copyright_skip_query', 'copyright_yahoo', - 'db_hostname', 'deIndentTables', 'fake_user_agent', 'flickr', - 'interwiki_contents_on_disk', 'line_separator', 'LS', 'msn_appid', - 'panoramio', 'persistent_http', 'proxy', 'special_page_limit', - 'splitLongParagraphs', 'sysopnames', 'use_mwparserfromhell', - 'use_SSL_onlogin', 'use_SSL_always', 'yahoo_appid', + 'absolute_import': '10.0.0 ', + 'division': '10.0.0', + 'unicode_literals': '10.0.0', } -_future_variables = {'absolute_import', 'division', 'unicode_literals'} # ############# ACCOUNT SETTINGS ############## @@ -998,7 +991,7 @@ def _assert_types( DEPRECATED_VARIABLE = ( - f'"{{}}" present in our {user_config_file} is no longer a supported' + f'"{{}}" present in your {user_config_file} is no longer a supported' ' configuration variable and should be removed. Please inform the' ' maintainers if you depend on it.' ) @@ -1026,7 +1019,7 @@ def _check_user_config_types( if name in _deprecated_variables: warn('\n' + fill(DEPRECATED_VARIABLE.format(name)), _ConfigurationDeprecationWarning) - elif name not in _future_variables: + else: warn('\n' + fill(f'Configuration variable "{name}" is defined ' f'in your {user_config_file} but unknown. It' ' can be a misspelled one or a variable that'