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

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.14.1
    • Fix Version/s: 5.15.1
    • Component/s: PySide
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      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

              Assignee:
              ctismer Christian Tismer
              Reporter:
              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