Skip to content

Commit 674183d

Browse files
committed
Move imports to be at the beginning of the file as suggested by @ccordoba12
1 parent a2451e1 commit 674183d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

qtpy/QtGui.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88

99
"""Provides QtGui classes and functions."""
1010

11+
from functools import partialmethod
1112

1213
from packaging.version import parse
1314

1415
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6
1516
from . import QT_VERSION as _qt_version
16-
from ._utils import getattr_missing_optional_dep, possibly_static_exec
17+
from ._utils import (
18+
getattr_missing_optional_dep,
19+
possibly_static_exec,
20+
set_shortcut,
21+
set_shortcuts,
22+
)
23+
1724

1825
_missing_optional_names = {}
1926

@@ -260,12 +267,6 @@ def movePositionPatched(
260267

261268
# Make `QAction.setShortcut` and `QAction.setShortcuts` compatible with Qt>=6.4
262269
if PYQT5 or PYSIDE2 or parse(_qt_version) < parse("6.4"):
263-
from functools import partialmethod
264-
265-
from ._utils import (
266-
set_shortcut,
267-
set_shortcuts,
268-
)
269270

270271
class _QAction(QAction):
271272
old_set_shortcut = QAction.setShortcut

qtpy/QtWidgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6
1515
from . import QT_VERSION as _qt_version
1616
from ._utils import (
17+
add_action,
1718
getattr_missing_optional_dep,
1819
possibly_static_exec,
1920
static_method_kwargs_wrapper,
@@ -211,7 +212,6 @@ def __getattr__(name):
211212

212213
# Make `addAction` compatible with Qt6 >= 6.4
213214
if PYQT5 or PYSIDE2 or parse(_qt_version) < parse("6.4"):
214-
from ._utils import add_action
215215

216216
class _QMenu(QMenu):
217217
old_add_action = QMenu.addAction

0 commit comments

Comments
 (0)