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

self should be added the arguments of non static function QFileInfo.exists() in pyi

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.1
    • 5.14.1
    • PySide
    • None
    • Windows
    • acb54ac2235199cbb710799d7934e56737bacfbb (pyside/pyside-setup/5.15)

    Description

      In QtCore.pyi, in the QFileInfo class declaration:

          @typing.overload
          @staticmethod
          def exists() -> bool: ...
          @typing.overload
          @staticmethod
          def exists(file:str) -> bool: ...
      

      The first method is not static. So when we call the function like this:

          fi = QFileInfo(__file__)
          if fi.exists():
              print(__file__ + " exists !")
      

      mypy reports an error:

      test.py:5: error: Attribute function "exists" with type "Callable[[], bool]" does not accept self argument
      Found 1 error in 1 file (checked 1 source file)
      

      when I put self in the arguments of the first function, mypy doesn't complain.

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-1328
          # Subject Branch Project Status CR V

          Activity

            People

              ctismer Christian Tismer
              jecaro Jean-Charles Quillet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes