1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
This commit is contained in:
Kelly Brazil
2021-09-24 08:43:09 -07:00
parent 7a4ebcd1ec
commit 22e151b01c
2 changed files with 55 additions and 59 deletions

View File

@ -116,7 +116,7 @@ def has_data(data):
Boolean True if input string (data) contains non-whitespace characters, otherwise False
"""
return True if data and not data.isspace() else False
return bool(data and not data.isspace())
def convert_to_int(value):
@ -204,7 +204,7 @@ def convert_to_bool(value):
pass
if value:
return True if value.lower() in truthy else False
return value.lower() in truthy
return False
@ -224,15 +224,15 @@ def stream_error(e, ignore_exceptions, line):
if not ignore_exceptions:
e.args = (str(e) + '... Use the ignore_exceptions option (-qq) to ignore streaming parser errors.',)
raise e
else:
return {
'_jc_meta':
{
'success': False,
'error': f'{e.__class__.__name__}: {e}',
'line': line.strip()
}
}
return {
'_jc_meta':
{
'success': False,
'error': f'{e.__class__.__name__}: {e}',
'line': line.strip()
}
}
class timestamp:
@ -307,10 +307,8 @@ class timestamp:
if 'UTC' in data:
utc_tz = True
if 'UTC+' in data or 'UTC-' in data:
if 'UTC+0000' in data or 'UTC-0000' in data:
utc_tz = True
else:
utc_tz = False
utc_tz = bool('UTC+0000' in data or 'UTC-0000' in data)
elif '+0000' in data or '-0000' in data:
utc_tz = True