Refactor/improve inspect plugin and Execute panel in preparation for runtime dependencies features #329

Merged
blacklight merged 27 commits from 271/runtime-integrations into master 2023-10-12 02:51:46 +02:00
1 changed files with 14 additions and 14 deletions
Showing only changes of commit 9acd71944c - Show all commits

View File

@ -34,21 +34,21 @@ class Message:
def parse_numpy(obj):
try:
import numpy as np
except ImportError:
return
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
if isinstance(obj, decimal.Decimal):
return float(obj)
if isinstance(obj, (bytes, bytearray)):
return '0x' + ''.join([f'{x:02x}' for x in obj])
if callable(obj):
return '<function at {}.{}>'.format(obj.__module__, obj.__name__)
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
if isinstance(obj, decimal.Decimal):
return float(obj)
if isinstance(obj, (bytes, bytearray)):
return '0x' + ''.join([f'{x:02x}' for x in obj])
if callable(obj):
return '<function at {}.{}>'.format(obj.__module__, obj.__name__)
except (ImportError, TypeError):
pass
return