Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tuple typing spec #144

Merged
merged 3 commits into from
Jan 17, 2024
Merged
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
18 changes: 6 additions & 12 deletions caveclient/chunkedgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import datetime
import json
import logging
import sys
from typing import Iterable, Union
from typing import Iterable, Tuple, Union
from urllib.parse import urlencode

import networkx as nx
Expand All @@ -19,11 +18,6 @@
default_global_server_address,
)

# get the version of python at runtime, decide how to specify tuple types

if sys.version_info < (3, 8):
from typing import Tuple as tuple

SERVER_KEY = "cg_server_address"

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -534,7 +528,7 @@ def execute_split(
root_id,
source_supervoxels=None,
sink_supervoxels=None,
) -> tuple[int, list]:
) -> Tuple[int, list]:
"""Execute a multicut split based on points or supervoxels.

Parameters
Expand Down Expand Up @@ -585,7 +579,7 @@ def preview_split(
source_supervoxels=None,
sink_supervoxels=None,
return_additional_ccs=False,
) -> tuple[list, list, bool, list]:
) -> Tuple[list, list, bool, list]:
"""Get supervoxel connected components from a preview multicut split.

Parameters
Expand Down Expand Up @@ -699,7 +693,7 @@ def get_contact_sites(self, root_id, bounds, calc_partners=False) -> dict:

def find_path(
self, root_id, src_pt, dst_pt, precision_mode=False
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Find a path between two locations on a root ID using the level 2 chunked
graph.
Expand Down Expand Up @@ -749,7 +743,7 @@ def find_path(

def get_subgraph(
self, root_id, bounds
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""Get subgraph of root id within a bounding box.

Parameters
Expand Down Expand Up @@ -1335,7 +1329,7 @@ def get_delta_roots(
timestamp_future: datetime.datetime = datetime.datetime.now(
datetime.timezone.utc
),
) -> tuple[np.ndarray, np.ndarray]:
) -> Tuple[np.ndarray, np.ndarray]:
"""
Get the list of roots that have changed between `timetamp_past` and
`timestamp_future`.
Expand Down