Skip to content

Commit

Permalink
[PEP8] rename transliteration.transliterator to Transliterator
Browse files Browse the repository at this point in the history
Change-Id: I5fb4b651360e32f4d65d07f2d5c35e494cb6c28f
  • Loading branch information
xqt committed Jan 31, 2024
1 parent 0c73ccc commit 4e43afb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ROADMAP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ Bugfixes
Breaking changes and code cleanups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* ``userinterfaces.transliteration.transliterator`` was renamed to :class:`Transliterator
<userinterfaces.transliteration.Transliterator>`
* ``pywikibot.BaseSite`` and ``pywikibotAPISite`` were dropped. :func:`pywikibot.Site` has to be used to create a
:mod:`site` object.
* ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to ``succ``
* ``next`` parameter of :meth:`userinterfaces.transliteration.Transliterator.transliterate` was renamed to ``succ``
* ``type`` parameter of :meth:`site.APISite.protectedpages()<pywikibot.site._generators.GeneratorsMixin.protectedpages>`
was renamed to ``protect_type``
* ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>` was renamed to
Expand Down Expand Up @@ -65,6 +67,8 @@ Breaking changes and code cleanups
Deprecations
------------

* 9.0.0: ``userinterfaces.transliteration.transliterator`` was renamed to :class:`Transliterator
<userinterfaces.transliteration.Transliterator>`
* 9.0.0: ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to
``succ``
* 9.0.0: ``type`` parameter of :meth:`site.APISite.protectedpages()
Expand Down
2 changes: 1 addition & 1 deletion pywikibot/userinterfaces/terminal_interface_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from pywikibot.userinterfaces._interface_base import ABUIC


transliterator = transliteration.transliterator(config.console_encoding)
transliterator = transliteration.Transliterator(config.console_encoding)

#: Colors supported by Pywikibot
colors = [
Expand Down
8 changes: 6 additions & 2 deletions pywikibot/userinterfaces/transliteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
from __future__ import annotations

from pywikibot.tools import deprecate_arg
from pywikibot.tools import ModuleDeprecationWrapper, deprecate_arg


#: Non latin digits used by the framework
Expand Down Expand Up @@ -1100,7 +1100,7 @@
_trans.update({char: str(i) for i, char in enumerate(digits)})


class transliterator: # noqa: N801
class Transliterator:

"""Class to transliterating text."""

Expand Down Expand Up @@ -1150,3 +1150,7 @@ def transliterate(self, char: str, default: str = '?',
elif char == 'ຫ':
result = '' if next in 'ງຍນຣລຼຼວ' else 'h'
return result


wrapper = ModuleDeprecationWrapper(__name__)
wrapper.add_deprecated_attr('transliterator', Transliterator, since='9.0.0')

0 comments on commit 4e43afb

Please sign in to comment.