Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/ImageColor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any

import cv2
import numpy as np
import spatialmath.base.argcheck as argcheck

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self


from machinevisiontoolbox._image_typing import ImageMixinBase
Expand Down
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/ImageIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@

import os
import os.path
import sys
from pathlib import Path
from typing import Any, SupportsFloat, cast

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self

import matplotlib.patches as mpatches
import matplotlib.patheffects as path_effects
Expand Down
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/ImageMorph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from __future__ import annotations

import sys
import time
from typing import TYPE_CHECKING, Any

Expand All @@ -14,10 +13,7 @@
from machinevisiontoolbox._image_typing import ImageMixinBase
from machinevisiontoolbox.Kernel import Kernel

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self

if TYPE_CHECKING:
pass
Expand Down
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/ImageMultiview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any

import cv2
import numpy as np

from machinevisiontoolbox._image_typing import ImageMixinBase

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self

if TYPE_CHECKING:
from machinevisiontoolbox.ImageCore import Image
Expand Down
9 changes: 1 addition & 8 deletions src/machinevisiontoolbox/ImageReshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@

import math
from collections.abc import Callable
from typing import Any, cast

try:
from typing import Self
except ImportError:
from typing_extensions import Self

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any, Self, cast

import cv2
import matplotlib.pyplot as plt
Expand Down
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/ImageTensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
pass

import numpy as np

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self
from machinevisiontoolbox._image_typing import ImageMixinBase

try:
Expand Down
6 changes: 1 addition & 5 deletions src/machinevisiontoolbox/_image_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any, Protocol

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing import Self
import numpy as np

from machinevisiontoolbox.mvtb_types import Array2d, Dtype
Expand Down
11 changes: 3 additions & 8 deletions tests/test_entry_points.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import importlib.util
import re
import tomllib
import unittest
from pathlib import Path

Expand All @@ -13,14 +13,9 @@ def console_scripts(text: str) -> list[tuple[str, str, str]]:

:param text: contents of a pyproject.toml file
:return: list of (command name, module, function) tuples

A regex is used rather than ``tomllib`` because the latter is only in the
standard library from Python 3.11 and this package supports 3.10.
"""
match = re.search(r"^\[project\.scripts\]\n(.*?)(?=^\[|\Z)", text, re.S | re.M)
if match is None:
return []
return re.findall(r'^([\w-]+)\s*=\s*"([\w.]+):(\w+)"', match.group(1), re.M)
scripts = tomllib.loads(text).get("project", {}).get("scripts", {})
return [(name, *target.split(":")) for name, target in scripts.items()]


def missing_modules(text: str) -> list[str]:
Expand Down
Loading