豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit ef1cdc2

Browse files
committed
refactor: Use listcomp in Python code, improve readability
1 parent a95fb15 commit ef1cdc2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ runs:
6868
with open(r"${{ github.action_path }}/bin/resources.json", "r") as f:
6969
json_content = json.load(f)
7070
71-
matching_versions = list(filter(lambda el: el["version"] == "${{ inputs.jython-version }}".strip(), json_content))
71+
matching_versions = [
72+
el for el in json_content
73+
if el["version"] == "${{ inputs.jython-version }}".strip()
74+
]
7275
7376
if not matching_versions:
7477
print("::error title=No matching versions found::No versions were found that matched the string '${{ inputs.jython-version }}'")
@@ -81,7 +84,10 @@ runs:
8184
sys.exit(1)
8285
8386
current_runner_os = "${{ runner.os }}-${{ runner.arch }}"
84-
if type(matching_versions[0]['available']) == list and current_runner_os.lower() not in [s.lower() for s in matching_versions[0]['available']]:
87+
if (
88+
type(matching_versions[0]['available']) == list
89+
and current_runner_os.lower() not in [s.lower() for s in matching_versions[0]['available']]
90+
):
8591
print("::warning title=Version not available for current runner::Runner '{}' not supported".format(current_runner_os))
8692
print("::error title=Version not available for current runner::The specified version (${{ inputs.jython-version }}) is currently available only for the following runners: {} (current is '{}').".format(', '.join(matching_versions[0]['available']), current_runner_os))
8793
sys.exit(1)

0 commit comments

Comments
 (0)