Skip to content

Commit

Permalink
paquo: better handling of circular imports when typechecking
Browse files Browse the repository at this point in the history
prevents a bug in sphinx
  • Loading branch information
ap-- committed Aug 21, 2020
1 parent 9ad9299 commit 492018e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions paquo/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from paquo.pathobjects import QuPathPathAnnotationObject, _PathROIObject, QuPathPathDetectionObject, \
QuPathPathTileObject
if TYPE_CHECKING: # pragma: no cover
from paquo.images import QuPathProjectImageEntry
import paquo.images

PathROIObjectType = TypeVar("PathROIObjectType", bound=_PathROIObject)

Expand Down Expand Up @@ -66,7 +66,7 @@ def __repr__(self):
class QuPathPathObjectHierarchy(QuPathBase[PathObjectHierarchy]):

def __init__(self, hierarchy: Optional[PathObjectHierarchy] = None,
*, _image_ref: Optional['QuPathProjectImageEntry'] = None) -> None:
*, _image_ref: Optional['paquo.images.QuPathProjectImageEntry'] = None) -> None:
"""qupath hierarchy stores all annotation objects
Parameters
Expand Down Expand Up @@ -200,7 +200,7 @@ def load_geojson(self, geojson: list) -> bool:
return changed

def __repr__(self):
img: Optional['QuPathProjectImageEntry'] = self._image_ref()
img: Optional['paquo.images.QuPathProjectImageEntry'] = self._image_ref()
if img:
img_name = img.image_name
else: # pragma: no cover
Expand All @@ -210,7 +210,7 @@ def __repr__(self):
def _repr_html_(self):
from paquo._repr import br, div, h4, p, span

img: Optional['QuPathProjectImageEntry'] = self._image_ref()
img: Optional['paquo.images.QuPathProjectImageEntry'] = self._image_ref()
if img:
img_name = img.image_name
else: # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions paquo/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from paquo.java import String, DefaultProjectImageEntry, ImageType, ImageData, IOException, URI, URISyntaxException, \
PathIO, File, BufferedImage, FileNotFoundException
if TYPE_CHECKING:
from paquo.projects import QuPathProject
import paquo.projects

_log = get_logger(__name__)

Expand Down Expand Up @@ -375,7 +375,7 @@ def from_java(cls, java_enum) -> 'QuPathImageType':
class QuPathProjectImageEntry(QuPathBase[DefaultProjectImageEntry]):

def __init__(self, entry: DefaultProjectImageEntry,
*, _project_ref: Optional['QuPathProject'] = None) -> None:
*, _project_ref: Optional['paquo.projects.QuPathProject'] = None) -> None:
"""Wrapper for qupath image entries
this is normally not instantiated by the user
Expand Down

0 comments on commit 492018e

Please sign in to comment.