mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
style: auto-format with ruff
This commit is contained in:
parent
2fc528ebda
commit
88babfef25
2 changed files with 10 additions and 10 deletions
|
|
@ -15,9 +15,9 @@ from codeflash.code_utils.shell_utils import read_api_key_from_shell_config, sav
|
|||
def check_formatter_installed(
|
||||
formatter_cmds: list[str], exit_on_failure: bool = True, language: str = "python"
|
||||
) -> bool:
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.code_utils.formatter import format_code # noqa: PLC0415
|
||||
from codeflash.languages.registry import get_language_support_by_common_formatters # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
from codeflash.code_utils.formatter import format_code
|
||||
from codeflash.languages.registry import get_language_support_by_common_formatters
|
||||
|
||||
if not formatter_cmds or formatter_cmds[0] == "disabled":
|
||||
return True
|
||||
|
|
@ -68,7 +68,7 @@ def check_formatter_installed(
|
|||
|
||||
@lru_cache(maxsize=1)
|
||||
def get_codeflash_api_key() -> str:
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
|
||||
# Check environment variable first
|
||||
env_api_key = os.environ.get("CODEFLASH_API_KEY")
|
||||
|
|
@ -79,7 +79,7 @@ def get_codeflash_api_key() -> str:
|
|||
# If we have an env var but it's not in shell config, save it for persistence
|
||||
if env_api_key and not shell_api_key:
|
||||
try:
|
||||
from codeflash.either import is_successful # noqa: PLC0415
|
||||
from codeflash.either import is_successful
|
||||
|
||||
logger.debug("env_utils.py:get_codeflash_api_key - Saving API key from environment to shell config")
|
||||
result = save_api_key_to_rc(env_api_key)
|
||||
|
|
@ -108,7 +108,7 @@ def get_codeflash_api_key() -> str:
|
|||
f"{api_secret_docs_message}"
|
||||
)
|
||||
if is_repo_a_fork():
|
||||
from codeflash.code_utils.code_utils import exit_with_message # noqa: PLC0415
|
||||
from codeflash.code_utils.code_utils import exit_with_message
|
||||
|
||||
msg = (
|
||||
"Codeflash API key not detected in your environment. It appears you're running Codeflash from a GitHub fork.\n"
|
||||
|
|
@ -128,7 +128,7 @@ def get_codeflash_api_key() -> str:
|
|||
|
||||
|
||||
def ensure_codeflash_api_key() -> bool:
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
|
||||
try:
|
||||
get_codeflash_api_key()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def is_powershell() -> bool:
|
|||
2. COMSPEC pointing to powershell.exe
|
||||
3. TERM_PROGRAM indicating Windows Terminal (often uses PowerShell)
|
||||
"""
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
|
||||
if os.name != "nt":
|
||||
return False
|
||||
|
|
@ -73,7 +73,7 @@ def is_powershell() -> bool:
|
|||
|
||||
def read_api_key_from_shell_config() -> Optional[str]:
|
||||
"""Read API key from shell configuration file."""
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
|
||||
shell_rc_path = get_shell_rc_path()
|
||||
# Ensure shell_rc_path is a Path object for consistent handling
|
||||
|
|
@ -130,7 +130,7 @@ def get_api_key_export_line(api_key: str) -> str:
|
|||
|
||||
def save_api_key_to_rc(api_key: str) -> Result[str, str]:
|
||||
"""Save API key to the appropriate shell configuration file."""
|
||||
from codeflash.cli_cmds.console import logger # noqa: PLC0415
|
||||
from codeflash.cli_cmds.console import logger
|
||||
|
||||
shell_rc_path = get_shell_rc_path()
|
||||
# Ensure shell_rc_path is a Path object for consistent handling
|
||||
|
|
|
|||
Loading…
Reference in a new issue