From 28be2972e5cac3032452337502a4f31855d6d871 Mon Sep 17 00:00:00 2001 From: satos Date: Thu, 5 Sep 2024 19:20:06 +0900 Subject: [PATCH] apply manual fix warned by ruff check --- misc/MV_python_integrator.py | 2 +- src/ProbBlackBoxChecking.py | 4 ++-- src/prism_export_to_dot_model.py | 7 +++++-- src/tests/Smc_test.py | 9 ++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/misc/MV_python_integrator.py b/misc/MV_python_integrator.py index 98a5db7..2bad079 100644 --- a/misc/MV_python_integrator.py +++ b/misc/MV_python_integrator.py @@ -78,7 +78,7 @@ def get_time(self): return self.number_of_steps def eval(self, observation): - if self.current_output == None: + if self.current_output is None: return 0 else: # MDPの出力は次のような文字列 'agree__six__c1_tails__c2_tails' diff --git a/src/ProbBlackBoxChecking.py b/src/ProbBlackBoxChecking.py index d2e3eee..61e5319 100644 --- a/src/ProbBlackBoxChecking.py +++ b/src/ProbBlackBoxChecking.py @@ -380,7 +380,7 @@ def find_cex(self, hypothesis): if not self.only_classical_equivalence_testing: logging.info(f"CEX from SMC: {cex}") - if cex != -1 and cex != None: + if cex != -1 and cex is not None: # 具体的な反例が得られればそれを返す return cex @@ -407,7 +407,7 @@ def find_cex(self, hypothesis): cex = compare_frequency_with_tail( smc.exec_sample, mdp, self.statistical_test_bound ) - if cex != None: + if cex is not None: logging.info(f"CEX from compare_frequency : {cex}") return cex logging.info("Could not find counterexample by compare_frequency.") diff --git a/src/prism_export_to_dot_model.py b/src/prism_export_to_dot_model.py index eb8c6d5..3a03ff2 100644 --- a/src/prism_export_to_dot_model.py +++ b/src/prism_export_to_dot_model.py @@ -28,7 +28,8 @@ def main(): labels = {} name_of_labels = {} - initial_state = None + # XXX: unused + # initial_state = None label_name_line_regex = re.compile('(\d+="\w+" )*(\d+="\w+")') label_name_regex = re.compile('(\d+)="(\w+)"') label_regex = re.compile("(\d+): (.*)") @@ -48,7 +49,9 @@ def main(): for idx in m_index: name = name_of_labels[idx] if name == "init": - initial_state = m[1] + # XXX: unused + # initial_state = m[1] + pass if name not in except_names: label_names.append(name) labels[m[1]] = "__".join(label_names) diff --git a/src/tests/Smc_test.py b/src/tests/Smc_test.py index a67445b..24e4aea 100644 --- a/src/tests/Smc_test.py +++ b/src/tests/Smc_test.py @@ -61,11 +61,14 @@ def test_initialize(self): custom_print(smc.spec_monitor) smc.reset_sut() - ret = smc.one_step() + # XXX: unused + # ret = smc.one_step() smc.step_monitor(smc.current_output) - ret = smc.one_step() + # XXX: unused + # ret = smc.one_step() smc.step_monitor(smc.current_output) - ret = smc.one_step() + # XXX: unused + # ret = smc.one_step() smc.step_monitor(smc.current_output) 0