Skip to content

Commit

Permalink
Coverage: ignore if TYPE_CHECKING globally
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Mar 7, 2024
1 parent e0f1f66 commit 7bb2941
Show file tree
Hide file tree
Showing 59 changed files with 214 additions and 151 deletions.
6 changes: 5 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ omit =
*/plotpy/plot/interactive.py
*.vscode/extensions*
*/qwt/*
*/guidata/*
*/guidata/*

exclude_lines =
if __name__ == .__main__.:
if TYPE_CHECKING:
2 changes: 1 addition & 1 deletion plotpy/builder/curvemarker.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
update_style_attr,
)

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from typing import Callable

CURVE_COUNT = 0
Expand Down
2 changes: 1 addition & 1 deletion plotpy/builder/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
XYImageParam,
)

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from plotpy.items.image.filter import ImageFilterItem

IMAGE_COUNT = 0
Expand Down
2 changes: 1 addition & 1 deletion plotpy/builder/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from plotpy.plot import PlotDialog, PlotOptions, PlotWidget, PlotWindow
from plotpy.styles import COLORS, GridParam, LineStyleParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from qtpy.QtWidgets import QWidget

from plotpy.constants import PlotType
Expand Down
2 changes: 1 addition & 1 deletion plotpy/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import numpy as np

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from qtpy.QtCore import QPointF
from qwt import QwtPlot, QwtPlotItem

Expand Down
2 changes: 1 addition & 1 deletion plotpy/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
from plotpy.coords import axes_to_canvas, canvas_to_axes
from plotpy.items.shape.marker import Marker

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from qtpy.QtCore import QPoint

from plotpy.plot.base import BasePlot
Expand Down
2 changes: 1 addition & 1 deletion plotpy/external/sliders/_misc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from contextlib import contextmanager
from typing import TYPE_CHECKING, Iterator

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from qtpy.QtCore import QObject


Expand Down
2 changes: 1 addition & 1 deletion plotpy/external/sliders/_range_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from qtpy.QtWidgets import QApplication, QSlider, QStyleOptionSlider

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from ._generic_range_slider import _GenericRangeSlider


Expand Down
18 changes: 11 additions & 7 deletions plotpy/interfaces/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import numpy as np

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io
from qtpy.QtCore import QPointF

Expand Down Expand Up @@ -242,9 +242,11 @@ class ISerializableType(IItemType):

def serialize(
self,
writer: guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter,
writer: (
guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter
),
) -> None:
"""Serialize object to HDF5 writer
Expand All @@ -254,9 +256,11 @@ def serialize(

def deserialize(
self,
reader: guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader,
reader: (
guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader
),
) -> None:
"""Deserialize object from HDF5 reader
Expand Down
2 changes: 1 addition & 1 deletion plotpy/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

from plotpy.config import _

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io


Expand Down
18 changes: 11 additions & 7 deletions plotpy/items/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from plotpy.styles.label import LabelParam
from plotpy.styles.shape import AnnotationParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io
import qwt.scale_map
from qtpy.QtCore import QPointF, QRectF
Expand Down Expand Up @@ -103,9 +103,11 @@ def __setstate__(self, state: tuple) -> None:

def serialize(
self,
writer: guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter,
writer: (
guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter
),
) -> None:
"""Serialize object to HDF5 writer
Expand All @@ -118,9 +120,11 @@ def serialize(

def deserialize(
self,
reader: guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader,
reader: (
guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader
),
) -> None:
"""Deserialize object from HDF5 reader
Expand Down
2 changes: 1 addition & 1 deletion plotpy/items/curve/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from plotpy.styles.base import SymbolParam
from plotpy.styles.curve import CurveParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io

from plotpy.interfaces import IItemType
Expand Down
18 changes: 11 additions & 7 deletions plotpy/items/curve/errorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from plotpy.styles.curve import CurveParam
from plotpy.styles.errorbar import ErrorBarParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io

from plotpy.plot.base import BasePlot
Expand Down Expand Up @@ -77,9 +77,11 @@ def __init__(

def serialize(
self,
writer: guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter,
writer: (
guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter
),
) -> None:
"""Serialize object to HDF5 writer
Expand All @@ -94,9 +96,11 @@ def serialize(

def deserialize(
self,
reader: guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader,
reader: (
guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader
),
) -> None:
"""Deserialize object from HDF5 reader
Expand Down
2 changes: 1 addition & 1 deletion plotpy/items/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from plotpy.interfaces import IBasePlotItem, IDecoratorItemType
from plotpy.styles.base import GridParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from qtpy.QtCore import QPointF

from plotpy.interfaces import IItemType
Expand Down
2 changes: 1 addition & 1 deletion plotpy/items/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from plotpy.styles.curve import CurveParam
from plotpy.styles.histogram import HistogramParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from plotpy.items.image.base import BaseImageItem
from plotpy.styles.base import ItemParameters

Expand Down
2 changes: 1 addition & 1 deletion plotpy/items/image/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from plotpy.mathutils.colormap import FULLRANGE, get_cmap
from plotpy.styles.image import RawImageParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io
import qwt.color_map
import qwt.scale_map
Expand Down
2 changes: 1 addition & 1 deletion plotpy/items/image/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)
raise

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import qwt.color_map
import qwt.scale_map
from qtpy.QtCore import QPointF, QRectF
Expand Down
34 changes: 21 additions & 13 deletions plotpy/items/image/image_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from plotpy.items.image.filter import XYImageFilterItem, to_bins
from plotpy.styles.image import ImageParam, RGBImageParam, XYImageParam

if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
import guidata.dataset.io
import qwt.color_map
import qwt.scale_map
Expand Down Expand Up @@ -128,9 +128,11 @@ def __setstate__(self, state: tuple) -> None:

def serialize(
self,
writer: guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter,
writer: (
guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter
),
) -> None:
"""Serialize object to HDF5 writer
Expand All @@ -146,9 +148,11 @@ def serialize(

def deserialize(
self,
reader: guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader,
reader: (
guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader
),
) -> None:
"""Deserialize object from HDF5 reader
Expand Down Expand Up @@ -538,9 +542,11 @@ def __setstate__(self, state: tuple) -> None:

def serialize(
self,
writer: guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter,
writer: (
guidata.dataset.io.HDF5Writer
| guidata.dataset.io.INIWriter
| guidata.dataset.io.JSONWriter
),
) -> None:
"""Serialize object to HDF5 writer
Expand All @@ -553,9 +559,11 @@ def serialize(

def deserialize(
self,
reader: guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader,
reader: (
guidata.dataset.io.HDF5Reader
| guidata.dataset.io.INIReader
| guidata.dataset.io.JSONReader
),
) -> None:
"""Deserialize object from HDF5 reader
Expand Down
Loading

0 comments on commit 7bb2941

Please sign in to comment.