From 1d53dcab9cac89b663762a5bb45b2be336304399 Mon Sep 17 00:00:00 2001 From: zzj <29055749+zjzh@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:39:44 +0800 Subject: [PATCH] refactoring code with For Else refactoring code with For Else which is more pythonic, concise and efficient than break --- sublime_jedi/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sublime_jedi/utils.py b/sublime_jedi/utils.py index 538ad73..6805454 100644 --- a/sublime_jedi/utils.py +++ b/sublime_jedi/utils.py @@ -166,13 +166,11 @@ def get_project_file_name(window): folders = project_json['folders'] found_all = True for directory in window.folders(): - found = False for folder in folders: - folder_path = re.sub(r'^/([^/])/', '\\1:/', folder['path']) + folder_path = re.sub('^/([^/])/', '\\1:/', folder['path']) if folder_path == directory.replace('\\', '/'): - found = True break - if not found: + else: found_all = False break