Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2318

Incorrect type hint syntax for QDBusAbstractInterfaceBase breaks mypy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 6.5.1, 6.6.0
    • 6.5.0
    • Type hints
    • None
    • All
    • 9b791c5d8 (dev), 0513274b5 (6.5)

    Description

      mypy (1.2.0) fails while checking PySide's types with

       

      > mypy .
      .venv/lib/python3.11/site-packages/PySide6/QtDBus.pyi:95: error: unexpected indent  [syntax]
      Found 1 error in 1 file (errors prevented further checking)
      

      I think the problem is the three dots (...) after the class declaration. AFAIK this is not allowed if class attributes are defined as well.

      So instead of:

       

      class QDBusAbstractInterfaceBase(PySide6.QtCore.QObject): ...
          destroyed                : ClassVar[Signal] = ... # destroyed()
          objectNameChanged        : ClassVar[Signal] = ... # objectNameChanged(QString)
      

      it should be:

       

      class QDBusAbstractInterfaceBase(PySide6.QtCore.QObject):
         destroyed                : ClassVar[Signal] = ... # destroyed()
         objectNameChanged        : ClassVar[Signal] = ... # objectNameChanged(QString)
      

      Unfortunately, this bug prevents mypy from checking any other code as well. Only excluding my own modules that use QtDbus is somewhat of a  workaround.

       

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ctismer Christian Tismer
            dynobo dynobo b.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes