diff --git a/mindinsight/lineagemgr/common/validator/model_parameter.py b/mindinsight/lineagemgr/common/validator/model_parameter.py index d4ee016b..c85ade6c 100644 --- a/mindinsight/lineagemgr/common/validator/model_parameter.py +++ b/mindinsight/lineagemgr/common/validator/model_parameter.py @@ -226,7 +226,7 @@ class SearchModelConditionParameter(Schema): if not isinstance(attr, str): raise LineageParamValueError('The search attribute not supported.') - if attr not in FIELD_MAPPING and not attr.startswith(('metric/','user_defined/')): + if attr not in FIELD_MAPPING and not attr.startswith(('metric/', 'user_defined/')): raise LineageParamValueError('The search attribute not supported.') if not isinstance(condition, dict): diff --git a/mindinsight/lineagemgr/common/validator/validate.py b/mindinsight/lineagemgr/common/validator/validate.py index 8883a2ce..07925870 100644 --- a/mindinsight/lineagemgr/common/validator/validate.py +++ b/mindinsight/lineagemgr/common/validator/validate.py @@ -354,9 +354,8 @@ def validate_condition(search_condition): log.error(err_msg) raise LineageParamValueError(err_msg) if not (sorted_name in FIELD_MAPPING - or (sorted_name.startswith('metric/') and len(sorted_name) > 7) - or (sorted_name.startswith('user_defined/') and len(sorted_name) > 13) - ): + or (sorted_name.startswith('metric/') and len(sorted_name) > 7) + or (sorted_name.startswith('user_defined/') and len(sorted_name) > 13)): log.error(err_msg) raise LineageParamValueError(err_msg) @@ -429,4 +428,4 @@ def validate_user_defined_info(user_defined_info): all_keys = field_map | user_defined_keys if len(field_map) + len(user_defined_keys) != len(all_keys): - raise LineageParamValueError("There are some keys have defined in lineage.") \ No newline at end of file + raise LineageParamValueError("There are some keys have defined in lineage.") diff --git a/mindinsight/lineagemgr/summary/_summary_adapter.py b/mindinsight/lineagemgr/summary/_summary_adapter.py index 1e99a6e9..21e18949 100644 --- a/mindinsight/lineagemgr/summary/_summary_adapter.py +++ b/mindinsight/lineagemgr/summary/_summary_adapter.py @@ -15,8 +15,8 @@ """The converter between proto format event of lineage and dict.""" import time -from mindinsight.datavisual.proto_files.mindinsight_lineage_pb2 import LineageEvent, UserDefinedInfo -from mindinsight.lineagemgr.common.exceptions.exceptions import LineageParamTypeError,\ +from mindinsight.datavisual.proto_files.mindinsight_lineage_pb2 import LineageEvent +from mindinsight.lineagemgr.common.exceptions.exceptions import LineageParamTypeError, \ LineageParamValueError from mindinsight.lineagemgr.common.log import logger as log @@ -345,4 +345,4 @@ def _package_user_defined_info(user_defined_dict, user_defined_message): try: getattr(add_user_defined_info, attr_name)[key] = value except ValueError: - raise LineageParamValueError("Value is out of range or not be supported yet.") \ No newline at end of file + raise LineageParamValueError("Value is out of range or not be supported yet.") diff --git a/mindinsight/lineagemgr/summary/summary_record.py b/mindinsight/lineagemgr/summary/summary_record.py index da56323f..0a53fb64 100644 --- a/mindinsight/lineagemgr/summary/summary_record.py +++ b/mindinsight/lineagemgr/summary/summary_record.py @@ -179,4 +179,4 @@ class LineageSummary: """ self.event_writer.write_event_to_file( package_user_defined_info(user_dict).SerializeToString() - ) \ No newline at end of file + ) diff --git a/tests/st/func/lineagemgr/api/test_model_api.py b/tests/st/func/lineagemgr/api/test_model_api.py index 8b2df937..8398b199 100644 --- a/tests/st/func/lineagemgr/api/test_model_api.py +++ b/tests/st/func/lineagemgr/api/test_model_api.py @@ -30,10 +30,9 @@ from mindinsight.lineagemgr import filter_summary_lineage, get_summary_lineage from mindinsight.lineagemgr.common.exceptions.exceptions import (LineageFileNotFoundError, LineageParamSummaryPathError, LineageParamTypeError, LineageParamValueError, LineageSearchConditionParamError) - from ..conftest import BASE_SUMMARY_DIR, DATASET_GRAPH, SUMMARY_DIR, SUMMARY_DIR_2 from .....ut.lineagemgr.querier import event_data -from os import environ + LINEAGE_INFO_RUN1 = { 'summary_dir': os.path.join(BASE_SUMMARY_DIR, 'run1'), 'metric': {