Skip to content
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
30 changes: 14 additions & 16 deletions src/oslg/oslg.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,12 @@ def trim(txt="", length=160) -> str:
"""
try:
length = int(length)
except ValueError as e:
except Exception:
length = 160

try:
txt = str(txt).strip()[:length]
except UnicodeEncodeError:
txt = ""
except Exception as e:
except Exception:
txt = ""

return txt
Expand Down Expand Up @@ -160,7 +158,7 @@ def tag(lvl=_level) -> str:
"""
try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return _tag[0]

if not 0 <= lvl < len(_tag):
Expand All @@ -184,7 +182,7 @@ def msg(stat=_status) -> str:
"""
try:
stat = int(stat)
except ValueError as e:
except Exception:
return _msg[0]

if not 0 <= stat < len(_msg):
Expand All @@ -210,7 +208,7 @@ def reset(lvl=CN.DEBUG) -> int:

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return _level

if CN.DEBUG <= lvl <= CN.FATAL:
Expand Down Expand Up @@ -244,12 +242,12 @@ def log(lvl=CN.DEBUG, message="", length=160) -> int:

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return _status

try:
length = int(length)
except ValueError as e:
except Exception:
return _status

if length > 160: length = 160
Expand Down Expand Up @@ -296,12 +294,12 @@ def invalid(id="", mth="", ord=0, lvl=CN.DEBUG, res=None):

try:
ord = int(ord)
except ValueError as e:
except Exception:
return res

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id or not mth or lvl < CN.DEBUG or lvl > CN.FATAL:
Expand Down Expand Up @@ -348,7 +346,7 @@ def mismatch(id="", obj=None, cl=None, mth="", lvl=CN.DEBUG, res=None):

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id: return res
Expand Down Expand Up @@ -396,7 +394,7 @@ def hashkey(id="", dct={}, key="", mth="", lvl=CN.DEBUG, res=None):

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id: return res
Expand Down Expand Up @@ -436,7 +434,7 @@ def empty(id="", mth="", lvl=CN.DEBUG, res=None):

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id: return res
Expand Down Expand Up @@ -474,7 +472,7 @@ def zero(id="", mth="", lvl=CN.DEBUG, res=None):

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id: return res
Expand Down Expand Up @@ -512,7 +510,7 @@ def negative(id="", mth="", lvl=CN.DEBUG, res=None):

try:
lvl = int(lvl)
except ValueError as e:
except Exception:
return res

if not id: return res
Expand Down