We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d3b6c4 commit 3307d6eCopy full SHA for 3307d6e
mydata_did/v1_0/utils/util.py
@@ -136,6 +136,22 @@ def current_datetime_in_iso8601() -> str:
136
"""
137
return str(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat())
138
139
+def str_to_bool(s: str) -> bool:
140
+ """
141
+ Convert a string to a boolean.
142
+
143
+ Args:
144
+ s: string to convert
145
146
+ Returns: boolean value
147
148
149
+ if s.lower() in ['true', 't', '1']:
150
+ return True
151
+ elif s.lower() in ['false', 'f', '0']:
152
+ return False
153
+ else:
154
+ raise ValueError('Cannot convert string to boolean: {}'.format(s))
155
156
if __name__ == "__main__":
157
print(canon_did("did:mydata:0:z6MkfiSdYhnLnS6jfwSf2yS2CiwwjZGmFUFL5QbyL2Xu8z2E"))
0 commit comments