Xqt created this task.
Xqt added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
    >>> import pwb, pywikibot as py
    >>> ns = py.Site().NamespaceDict
    >>> ns.PROJECT.id
    4
    >>> ns.MAIN.id
    0
    >>> ns.TALK.id
    1
    >>> ns.USER.id
    2
    >>> ns.USER_TALK.id
    Traceback (most recent call last):
      File "<pyshell#183>", line 1, in <module>
        ns.USER_TALK.id
      File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 540, in 
__getattr__
        return self.__getattribute__(attr)
    AttributeError: 'NamespacesDict' object has no attribute 'USER_TALK'
    >>> ns.PROJECT.id
    4
    >>> ns.PROJECT_TALK.id
    Traceback (most recent call last):
      File "<pyshell#185>", line 1, in <module>
        ns.PROJECT_TALK.id
      File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 540, in 
__getattr__
        return self.__getattribute__(attr)
    AttributeError: 'NamespacesDict' object has no attribute 'PROJECT_TALK'
  
  and calling as dict also fails
  
    >>> ns['PROJECT TALK'].id
    5
    >>> ns['PROJECT_TALK'].id
    Traceback (most recent call last):
      File "<pyshell#187>", line 1, in <module>
        ns['PROJECT_TALK'].id
      File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 521, in 
__getitem__
        return super(NamespacesDict, self).__getitem__(key)
      File "C:\Python38\lib\_collections_abc.py", line 655, in __getitem__
        raise KeyError
    KeyError
    >>> 
  
  There are namespace constants in Namespace class which works with underlines 
as this is a valid identifier (and btw. it seems they where never used):
  
    #MEDIA = -2
    SPECIAL = -1
    MAIN = 0
    TALK = 1
    USER = 2
    USER_TALK = 3
    PROJECT = 4
    PROJECT_TALK = 5
  
  I think NamespaceDict should respect the underlines

TASK DETAIL
  https://phabricator.wikimedia.org/T252940

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: Aklapper, Xqt, pywikibot-bugs-list, JohnsonLee01, Dijkstra, Zkhalido, 
Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, 
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to