Remove code excluded due to Python 3.9

This commit is contained in:
Veronica Berglyd Olsen
2025-01-11 18:53:51 +01:00
parent 31c58c29d5
commit 98db7db2b1
4 changed files with 4 additions and 16 deletions
+1 -4
View File
@@ -33,7 +33,7 @@ from collections.abc import Callable
from configparser import ConfigParser from configparser import ConfigParser
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, TypeVar from typing import Any, Literal, TypeGuard, TypeVar
from urllib.parse import urljoin from urllib.parse import urljoin
from urllib.request import pathname2url from urllib.request import pathname2url
@@ -44,9 +44,6 @@ from novelwriter.constants import nwConst, nwLabels, nwUnicode, trConst
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
from novelwriter.error import logException from novelwriter.error import logException
if TYPE_CHECKING: # pragma: no cover
from typing import TypeGuard # Requires Python 3.10
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_Type = TypeVar("_Type") _Type = TypeVar("_Type")
+1 -3
View File
@@ -60,9 +60,7 @@ NODE_FLAGS = Qt.ItemFlag.ItemIsEnabled
NODE_FLAGS |= Qt.ItemFlag.ItemIsSelectable NODE_FLAGS |= Qt.ItemFlag.ItemIsSelectable
NODE_FLAGS |= Qt.ItemFlag.ItemIsDropEnabled NODE_FLAGS |= Qt.ItemFlag.ItemIsDropEnabled
if TYPE_CHECKING: # pragma: no cover T_NodeData = str | QIcon | QFont | Qt.AlignmentFlag | None
# Requires Python 3.10
T_NodeData = str | QIcon | QFont | Qt.AlignmentFlag | None
class ProjectNode: class ProjectNode:
+1 -5
View File
@@ -30,7 +30,6 @@ from enum import Enum
from functools import partial from functools import partial
from pathlib import Path from pathlib import Path
from time import time from time import time
from typing import TYPE_CHECKING
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
@@ -45,15 +44,12 @@ from novelwriter.core.options import OptionState
from novelwriter.core.projectdata import NWProjectData from novelwriter.core.projectdata import NWProjectData
from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter, XMLReadState from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter, XMLReadState
from novelwriter.core.sessions import NWSessionLog from novelwriter.core.sessions import NWSessionLog
from novelwriter.core.status import T_StatusKind, T_UpdateEntry
from novelwriter.core.storage import NWStorage, NWStorageOpen from novelwriter.core.storage import NWStorage, NWStorageOpen
from novelwriter.core.tree import NWTree from novelwriter.core.tree import NWTree
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
from novelwriter.error import logException from novelwriter.error import logException
if TYPE_CHECKING: # pragma: no cover
# Requires Python 3.10
from novelwriter.core.status import T_StatusKind, T_UpdateEntry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
+1 -4
View File
@@ -29,7 +29,7 @@ import logging
import random import random
from collections.abc import Iterable from collections.abc import Iterable
from typing import TYPE_CHECKING, Literal from typing import TYPE_CHECKING, Literal, TypeGuard
from PyQt5.QtCore import QPointF, Qt from PyQt5.QtCore import QPointF, Qt
from PyQt5.QtGui import QColor, QIcon, QPainter, QPainterPath, QPixmap, QPolygonF from PyQt5.QtGui import QColor, QIcon, QPainter, QPainterPath, QPixmap, QPolygonF
@@ -39,9 +39,6 @@ from novelwriter.common import simplified
from novelwriter.enum import nwStatusShape from novelwriter.enum import nwStatusShape
from novelwriter.types import QtPaintAntiAlias, QtTransparent from novelwriter.types import QtPaintAntiAlias, QtTransparent
if TYPE_CHECKING: # pragma: no cover
from typing import TypeGuard # Requires Python 3.10
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)