-
Notifications
You must be signed in to change notification settings - Fork 13
feat: 为python脚本支持启动参数 #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LevelDownRefine
wants to merge
14
commits into
OneDragon-Anything:main
Choose a base branch
from
LevelDownRefine:copilot/fix-python-script-parameter-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9fb1388
Fix python script arguments
Copilot 5a71245
Add UI to edit python script arguments
Copilot 2dfd468
Revert "Add UI to edit python script arguments"
Copilot d482b01
Add script_arguments input in PythonCodeEditorDialog
Copilot b5980dd
Update placeholder text and move import to top
Copilot 5806848
docs: add necessary comments for python script arguments support
Copilot df073c8
fix: remove unnecessary comments from code we didn't add
Copilot 4d1b76f
Apply remaining changes
Copilot 2c49a21
refactor: revert script_config.py and extract layout to _setup_argume…
Copilot bbf41cc
refactor: remove redundant param description and add concise layout c…
Copilot a67c378
refactor: extract _get_args_list in script_runner.py
Copilot d887ca7
Refactor _get_args_list to accept script_arguments string directly
Copilot e682229
Change _get_args_list to return None if no args
Copilot 9c61827
refine code
LevelDownRefine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor
🧩 Analysis chain
🌐 Web query:
Does Python shlex.split with posix=False retain quote characters in the resulting tokens?💡 Result:
No, Python's shlex.split does not retain quote characters in the resulting tokens, regardless of whether posix is set to True or False [1][2]. The shlex module is designed to perform lexical analysis similar to a Unix shell [2]. In both POSIX and non-POSIX modes, the parser is configured to identify, process, and strip quote characters used to encapsulate tokens [2]. When you pass posix=False, you are selecting a non-POSIX compatibility mode that may change how specific characters are handled—such as how escapes or specific punctuation are treated—but it does not change the core behavior of stripping the quotes themselves [1][2]. If your goal is to preserve quote characters in the output, shlex.split is not the appropriate tool, as it is intended to resolve and remove shell-style quoting [1]. If you require access to the raw tokens including the original quotes, you can use the underlying shlex.shlex class directly, which provides lower-level control over the tokenization process [1]. For example, using the shlex.shlex class allows you to access individual tokens as they are parsed without the automatic stripping performed by the higher-level split function [1]: import shlex data = '"A Multi-line comment."' sh = shlex.shlex(data) print(list(iter(sh.get_token, ''))) # Output: ['"A Multi-line comment."']
Citations:
🏁 Script executed:
Repository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 790
🏁 Script executed:
sed -n '1,280p' src/script_chainer/win_exe/script_runner.pyRepository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 8221
🏁 Script executed:
sed -n '280,520p' src/script_chainer/win_exe/script_runner.pyRepository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 8202
🏁 Script executed:
sed -n '280,520p' src/script_chainer/win_exe/script_runner.pyRepository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 8202
🏁 Script executed:
grep -n "_run_python_script\|sys.argv\|extend(" -n src/script_chainer/win_exe/script_runner.pyRepository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 415
🏁 Script executed:
grep -n "_run_python_script\|sys.argv\|extend(" src/script_chainer/win_exe/script_runner.pyRepository: OneDragon-Anything/OneDragon-ScriptChainer
Length of output: 415
_get_args_list这里会把引号当作字面字符保留下来。--name "张三"会被传成'"张三"',sys.argv.extend(args_list)也会把这个值原样交给脚本。_launch_script和_run_python_script都复用这套解析,建议统一改成 shell 语义(posix=True)或在进入sys.argv前去掉外层引号。🤖 Prompt for AI Agents