Skip to content

Commit

Permalink
ruff: fix type import errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Nov 14, 2024
1 parent 5c3c336 commit f11b162
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions gmsh_interop/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@
THE SOFTWARE.
"""

try:
from packaging.version import Version
except ImportError:
from distutils.version import Version

import logging
from typing import Optional

from packaging.version import Version

from pytools import memoize_method

Expand Down Expand Up @@ -125,11 +121,11 @@ def __init__(self, source, filenames, source_name="temp.geo"):
self.filenames = filenames


def get_gmsh_version(executable: str = "gmsh") -> Optional[Version]:
def get_gmsh_version(executable: str = "gmsh") -> Version | None:
import re
re_version = re.compile(r"[0-9]+.[0-9]+.[0-9]+")

def get_gmsh_version_from_string(output: str) -> Optional[Version]:
def get_gmsh_version_from_string(output: str) -> Version | None:
result = re_version.search(output)

try_version = None
Expand Down
3 changes: 1 addition & 2 deletions gmsh_interop/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from importlib import metadata
from typing import Tuple


def _parse_version(version: str) -> Tuple[Tuple[int, ...], str]:
def _parse_version(version: str) -> tuple[tuple[int, ...], str]:
import re

m = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
Expand Down

0 comments on commit f11b162

Please sign in to comment.