Skip to content

Commit

Permalink
remove distutils
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Aug 30, 2024
1 parent 1cb7732 commit 65ed7f4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gunpowder/contrib/nodes/dvid_partner_annotation_source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import distutils.util
import numpy as np
import logging
import requests
Expand All @@ -14,6 +13,14 @@

logger = logging.getLogger(__name__)

def strtobool(val):
val = val.lower()
if val in ('y', 'yes', 't', 'true', 'on', '1'):
return 1
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return 0
else:
raise ValueError(f"Invalid truth value: {val}")

class DvidPartnerAnnoationSourceReadException(Exception):
pass
Expand Down Expand Up @@ -198,10 +205,10 @@ def __read_syn_points(self, roi):
props["agent"] = str(node["Prop"]["agent"])
if "flagged" in node["Prop"]:
str_value_flagged = str(node["Prop"]["flagged"])
props["flagged"] = bool(distutils.util.strtobool(str_value_flagged))
props["flagged"] = bool(strtobool(str_value_flagged))
if "multi" in node["Prop"]:
str_value_multi = str(node["Prop"]["multi"])
props["multi"] = bool(distutils.util.strtobool(str_value_multi))
props["multi"] = bool(strtobool(str_value_multi))

# create synPoint with information collected so far (partner_ids not completed yet)
if kind == "PreSyn":
Expand Down

0 comments on commit 65ed7f4

Please sign in to comment.