[Python API] Rename configuration API + update tests/tools (#9927)

* [Python API] Rename configuration API + update tests/tools

* keep old api for compatibility

* add deprecation warnings

* apply comments to query sample

* remove convert to pyobject

* use Any instead of string

* update tests

* update set_property

* fix sample

* update test + try-except for pot

* add docstrings

* fix codestyle for pot
This commit is contained in:
Anastasia Kuporosova authored and GitHub committed 2022-02-02 11:28:41 +03:00
1 parent 336fc37b94
commit 70f65bdb74
11 files changed
+166 -43

No files matched your search

@@ -8,12 +8,12 @@ import sys
from openvino.runtime import Core
def param_to_string(metric) -> str:
def param_to_string(parameters) -> str:
"""Convert a list / tuple of parameters returned from IE to a string"""
if isinstance(metric, (list, tuple)):
return ', '.join([str(x) for x in metric])
if isinstance(parameters, (list, tuple)):
return ', '.join([str(x) for x in parameters])
else:
return str(metric)
return str(parameters)
def main():
@@ -27,19 +27,19 @@ def main():
for device in core.available_devices:
log.info(f'{device} :')
log.info('\tSUPPORTED_METRICS:')
for metric in core.get_metric(device, 'SUPPORTED_METRICS'):
if metric not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS'):
for property_key in core.get_property(device, 'SUPPORTED_METRICS'):
if property_key not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS'):
try:
metric_val = core.get_metric(device, metric)
property_val = core.get_property(device, property_key)
except TypeError:
metric_val = 'UNSUPPORTED TYPE'
log.info(f'\t\t{metric}: {param_to_string(metric_val)}')
property_val = 'UNSUPPORTED TYPE'
log.info(f'\t\t{property_key}: {param_to_string(property_val)}')
log.info('')
log.info('\tSUPPORTED_CONFIG_KEYS (default values):')
for config_key in core.get_metric(device, 'SUPPORTED_CONFIG_KEYS'):
for config_key in core.get_property(device, 'SUPPORTED_CONFIG_KEYS'):
try:
config_val = core.get_config(device, config_key)
config_val = core.get_property(device, config_key)
except TypeError:
config_val = 'UNSUPPORTED TYPE'
log.info(f'\t\t{config_key}: {param_to_string(config_val)}')