Skip to content

Commit

Permalink
cleanup: remove old deprecation variables
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
xqt committed Jan 4, 2025
1 parent 8d3b480 commit 6e8ea13
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions pywikibot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##############

Expand Down Expand Up @@ -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.'
)
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 6e8ea13

Please sign in to comment.