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

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes