modules: fully type the Qt* modules

The base module is fully typed, but the numbered version are not, though
it's pretty trivial to do so.
pull/11274/head
Dylan Baker 2 years ago
parent e8a88f5320
commit 6ed6c8cdba
  1. 12
      mesonbuild/modules/qt4.py
  2. 12
      mesonbuild/modules/qt5.py
  3. 11
      mesonbuild/modules/qt6.py
  4. 3
      run_mypy.py

@ -12,17 +12,23 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import typing as T
from .qt import QtBaseModule from .qt import QtBaseModule
from . import ModuleInfo from . import ModuleInfo
if T.TYPE_CHECKING:
from ..interpreter import Interpreter
class Qt4Module(QtBaseModule): class Qt4Module(QtBaseModule):
INFO = ModuleInfo('qt4') INFO = ModuleInfo('qt4')
def __init__(self, interpreter): def __init__(self, interpreter: Interpreter):
QtBaseModule.__init__(self, interpreter, qt_version=4) QtBaseModule.__init__(self, interpreter, qt_version=4)
def initialize(*args, **kwargs): def initialize(interp: Interpreter) -> Qt4Module:
return Qt4Module(*args, **kwargs) return Qt4Module(interp)

@ -12,17 +12,23 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import typing as T
from .qt import QtBaseModule from .qt import QtBaseModule
from . import ModuleInfo from . import ModuleInfo
if T.TYPE_CHECKING:
from ..interpreter import Interpreter
class Qt5Module(QtBaseModule): class Qt5Module(QtBaseModule):
INFO = ModuleInfo('qt5') INFO = ModuleInfo('qt5')
def __init__(self, interpreter): def __init__(self, interpreter: Interpreter):
QtBaseModule.__init__(self, interpreter, qt_version=5) QtBaseModule.__init__(self, interpreter, qt_version=5)
def initialize(*args, **kwargs): def initialize(interp: Interpreter) -> Qt5Module:
return Qt5Module(*args, **kwargs) return Qt5Module(interp)

@ -12,17 +12,22 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import typing as T
from .qt import QtBaseModule from .qt import QtBaseModule
from . import ModuleInfo from . import ModuleInfo
if T.TYPE_CHECKING:
from ..interpreter import Interpreter
class Qt6Module(QtBaseModule): class Qt6Module(QtBaseModule):
INFO = ModuleInfo('qt6', '0.57.0') INFO = ModuleInfo('qt6', '0.57.0')
def __init__(self, interpreter): def __init__(self, interpreter: Interpreter):
QtBaseModule.__init__(self, interpreter, qt_version=6) QtBaseModule.__init__(self, interpreter, qt_version=6)
def initialize(*args, **kwargs): def initialize(interp: Interpreter) -> Qt6Module:
return Qt6Module(*args, **kwargs) return Qt6Module(interp)

@ -51,6 +51,9 @@ modules = [
'mesonbuild/modules/modtest.py', 'mesonbuild/modules/modtest.py',
'mesonbuild/modules/pkgconfig.py', 'mesonbuild/modules/pkgconfig.py',
'mesonbuild/modules/qt.py', 'mesonbuild/modules/qt.py',
'mesonbuild/modules/qt4.py',
'mesonbuild/modules/qt5.py',
'mesonbuild/modules/qt6.py',
'mesonbuild/modules/rust.py', 'mesonbuild/modules/rust.py',
'mesonbuild/modules/sourceset.py', 'mesonbuild/modules/sourceset.py',
'mesonbuild/modules/wayland.py', 'mesonbuild/modules/wayland.py',

Loading…
Cancel
Save