diff --git a/src/agora/utils/cast.py b/src/agora/utils/cast.py new file mode 100644 index 0000000000000000000000000000000000000000..1a9fecd37cd64a2828551dbe6120386f9033801b --- /dev/null +++ b/src/agora/utils/cast.py @@ -0,0 +1,16 @@ +#!/usr/bin/env jupyter + +""" +Convert some types to others +""" + + +def _str_to_int(x: str or None): + """ + Cast string as int if possible. If Nonetype return None. + """ + if x: + try: + return int(x) + except: + return x