Port get.py improvements from upstream.

Generally standardizes the get_* helpers:
 - Adds type hinting.
 - Deduplicates block property addition.
 - Respects `graceful` in more contexts.
 - More resilient to invalid user input / less boilerplate necessary
   at call-sites.
This commit is contained in:
TLSM 2022-11-28 12:36:04 -05:00
parent 6b832aba99
commit 9953c5763c
No known key found for this signature in database
GPG key ID: E745A82778055C7E
3 changed files with 193 additions and 160 deletions

View file

@ -1,8 +1,9 @@
import typing
# clean strings for searching
def sql_ilike_clean(my_str):
if my_str is None:
return None
return my_str.replace(r'\\', '').replace('_', r'\_').replace('%', '').strip()
# this will also just return a bool verbatim