Skip to content

Commit

Permalink
Moved Python variants to a constant (microsoft#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshTrim committed Apr 11, 2024
1 parent 90bc393 commit e8b3e5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ..cache.cache import AbstractCache
from ..code_utils import (
UNKNOWN,
PYTHON_VARIANTS,
check_can_use_docker_or_throw,
content_str,
decide_use_docker,
Expand Down Expand Up @@ -2079,7 +2080,7 @@ def execute_code_blocks(self, code_blocks):
)
if lang in ["bash", "shell", "sh"]:
exitcode, logs, image = self.run_code(code, lang=lang, **self._code_execution_config)
elif lang in ["python", "Python", "py"]:
elif lang in PYTHON_VARIANTS:
if code.startswith("# filename: "):
filename = code[11 : code.find("\n")].strip()
else:
Expand Down
1 change: 1 addition & 0 deletions autogen/code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
DEFAULT_TIMEOUT = 600
WIN32 = sys.platform == "win32"
PATH_SEPARATOR = WIN32 and "\\" or "/"
PYTHON_VARIANTS = ["python", "Python", "py"]

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit e8b3e5e

Please sign in to comment.