fix lint error

This commit is contained in:
bobo 2024-06-30 16:11:31 +08:00
parent 8cbb645fa8
commit bb3d04d7a9
3 changed files with 11 additions and 4 deletions

View File

@ -101,8 +101,8 @@ logger.add(
from merico.pr.config_util import (
get_gitlab_host,
get_repo_type,
read_server_access_token_with_input,
read_review_inline_config,
read_server_access_token_with_input,
)
from merico.pr.custom_suggestions_config import get_custom_suggestions_system_prompt

View File

@ -4,7 +4,6 @@ import sys
from lib.chatmark import Checkbox
# Configuration items
CONFIG_ITEMS = {
"pr_review_inline": "PR Review Inline Enabled",
@ -13,6 +12,7 @@ CONFIG_ITEMS = {
# Configuration file paths
GLOBAL_CONFIG_PATH = os.path.join(os.path.expanduser("~"), ".chat", ".workflow_config.json")
def read_config(config_path, item):
if os.path.exists(config_path):
with open(config_path, "r", encoding="utf-8") as f:
@ -20,6 +20,7 @@ def read_config(config_path, item):
return config.get(item)
return None
def save_config(config_path, item, value):
if os.path.exists(config_path):
with open(config_path, "r", encoding="utf-8") as f:
@ -49,10 +50,13 @@ def is_pre_review_inline_enabled(current_value=False):
return None
return False
def main():
print("Starting configuration of workflow settings...", end="\n\n", flush=True)
print("If you want to change access token or host url, "
"please edit the configuration file directly.")
print(
"If you want to change access token or host url, "
"please edit the configuration file directly."
)
print("Configuration file is located at:", GLOBAL_CONFIG_PATH, end="\n\n", flush=True)
pr_review_inline_enable = read_config(GLOBAL_CONFIG_PATH, "pr_review_inline")
@ -63,5 +67,6 @@ def main():
print("Workflow settings configuration successful.")
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -114,6 +114,7 @@ def read_gitlab_host():
return config_data["gitlab_host"]
return ""
def read_review_inline_config():
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")
if os.path.exists(config_path):
@ -123,6 +124,7 @@ def read_review_inline_config():
return config_data["pr_review_inline"]
return False
def save_github_token(github_token):
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")