Skip to content

Commit

Permalink
SkeletonClient retrieves valid skeleton versions from server instead …
Browse files Browse the repository at this point in the history
…of having them hard-coded. No future updates necessary when new versions are introduced.
  • Loading branch information
kebwi committed Dec 20, 2024
1 parent af16785 commit bf9a5d9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions caveclient/skeletonservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ def get_cache_contents(
datastack_name = self._datastack_name
assert datastack_name is not None

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
skeleton_versions = self.get_versions()
if skeleton_version not in skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
f"Unknown skeleton version: {skeleton_version}. Valid options: {skeleton_versions}"
)

if isinstance(root_id_prefixes, int):
Expand Down Expand Up @@ -408,10 +408,10 @@ def skeletons_exist(
datastack_name = self._datastack_name
assert datastack_name is not None

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
skeleton_versions = self.get_versions()
if skeleton_version not in skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
f"Unknown skeleton version: {skeleton_version}. Valid options: {skeleton_versions}"
)

if isinstance(root_ids, int):
Expand Down Expand Up @@ -540,10 +540,10 @@ def get_skeleton(
elif output_format == "swc":
endpoint_format = "swccompressed"

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
skeleton_versions = self.get_versions()
if skeleton_version not in skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
f"Unknown skeleton version: {skeleton_version}. Valid options: {skeleton_versions}"
)

if verbose_level >= 1:
Expand Down Expand Up @@ -650,10 +650,10 @@ def get_bulk_skeletons(
elif output_format == "swc":
endpoint_format = "swccompressed"

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
skeleton_versions = self.get_versions()
if skeleton_version not in skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
f"Unknown skeleton version: {skeleton_version}. Valid options: {skeleton_versions}"
)

url = self._build_bulk_endpoint(
Expand Down

0 comments on commit bf9a5d9

Please sign in to comment.