Source code for qiskit_experiments.database_service.constants
# This code is part of Qiskit.## (C) Copyright IBM 2021, 2022.## This code is licensed under the Apache License, Version 2.0. You may# obtain a copy of this license in the LICENSE.txt file in the root directory# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.## Any modifications or derivative works of this code must retain this# copyright notice, and modified files need to carry a notice indicating# that they have been altered from the originals."""Experiment constants."""from__future__importannotationsimportenum
[docs]classResultQuality(enum.Enum):"""Possible values for analysis result quality."""BAD="bad"GOOD="good"UNKNOWN="unknown"
[docs]@staticmethoddeffrom_str(quality:str)->ResultQuality:"""Convert quality to a ResultQuality, defaulting to UNKNOWN"""try:result=ResultQuality(str(quality).lower())exceptValueError:result=ResultQuality.UNKNOWNreturnresult
[docs]@staticmethoddefto_str(quality:ResultQuality)->str:"""Convert quality to string, defaulting to "unknown" """ifisinstance(quality,ResultQuality):returnquality.valuereturn"unknown"