Update ruff to 0.11.2 (#36962)
* update * update * update --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -736,7 +736,7 @@ def replace_default_in_arg_description(description: str, default: Any) -> str:
|
||||
elif _re_parse_description.search(description) is None:
|
||||
idx = description.find(OPTIONAL_KEYWORD)
|
||||
len_optional = len(OPTIONAL_KEYWORD)
|
||||
description = f"{description[:idx + len_optional]}, defaults to {str_default}"
|
||||
description = f"{description[: idx + len_optional]}, defaults to {str_default}"
|
||||
else:
|
||||
description = _re_parse_description.sub(rf"*optional*, defaults to {str_default}", description)
|
||||
|
||||
|
||||
@@ -79,9 +79,11 @@ def format_mrpc(data_dir, path_to_data):
|
||||
for row in ids_fh:
|
||||
dev_ids.append(row.strip().split("\t"))
|
||||
|
||||
with open(mrpc_train_file, encoding="utf8") as data_fh, open(
|
||||
os.path.join(mrpc_dir, "train.tsv"), "w", encoding="utf8"
|
||||
) as train_fh, open(os.path.join(mrpc_dir, "dev.tsv"), "w", encoding="utf8") as dev_fh:
|
||||
with (
|
||||
open(mrpc_train_file, encoding="utf8") as data_fh,
|
||||
open(os.path.join(mrpc_dir, "train.tsv"), "w", encoding="utf8") as train_fh,
|
||||
open(os.path.join(mrpc_dir, "dev.tsv"), "w", encoding="utf8") as dev_fh,
|
||||
):
|
||||
header = data_fh.readline()
|
||||
train_fh.write(header)
|
||||
dev_fh.write(header)
|
||||
@@ -92,9 +94,10 @@ def format_mrpc(data_dir, path_to_data):
|
||||
else:
|
||||
train_fh.write("%s\t%s\t%s\t%s\t%s\n" % (label, id1, id2, s1, s2))
|
||||
|
||||
with open(mrpc_test_file, encoding="utf8") as data_fh, open(
|
||||
os.path.join(mrpc_dir, "test.tsv"), "w", encoding="utf8"
|
||||
) as test_fh:
|
||||
with (
|
||||
open(mrpc_test_file, encoding="utf8") as data_fh,
|
||||
open(os.path.join(mrpc_dir, "test.tsv"), "w", encoding="utf8") as test_fh,
|
||||
):
|
||||
header = data_fh.readline()
|
||||
test_fh.write("index\t#1 ID\t#2 ID\t#1 String\t#2 String\n")
|
||||
for idx, row in enumerate(data_fh):
|
||||
|
||||
@@ -68,4 +68,4 @@ if __name__ == "__main__":
|
||||
job_time = dict(sorted(job_time.items(), key=lambda item: item[1]["duration"], reverse=True))
|
||||
|
||||
for k, v in job_time.items():
|
||||
print(f'{k}: {v["duration"]}')
|
||||
print(f"{k}: {v['duration']}")
|
||||
|
||||
@@ -513,7 +513,7 @@ def find_all_dependencies(
|
||||
all_dependencies = set()
|
||||
all_dependencies_with_parent = []
|
||||
checked_dependencies = set(initial_checked_dependencies)
|
||||
parents = {initial_dep: start_entity for initial_dep in initial_dependencies}
|
||||
parents = dict.fromkeys(initial_dependencies, start_entity)
|
||||
while len(dependency_queue) > 0:
|
||||
# Pick element to visit
|
||||
current = dependency_queue.popleft()
|
||||
@@ -524,7 +524,7 @@ def find_all_dependencies(
|
||||
if current in dependency_mapping.keys():
|
||||
# Update dependency queue
|
||||
dependency_queue.extend(dependency_mapping[current])
|
||||
parents.update({dep: current for dep in dependency_mapping[current]})
|
||||
parents.update(dict.fromkeys(dependency_mapping[current], current))
|
||||
# add visited node to the list
|
||||
checked_dependencies.add(current)
|
||||
|
||||
|
||||
@@ -665,7 +665,7 @@ class Message:
|
||||
|
||||
failure_text = ""
|
||||
for idx, error in enumerate(failures):
|
||||
new_text = failure_text + f'*{error["line"]}*\n_{error["trace"]}_\n\n'
|
||||
new_text = failure_text + f"*{error['line']}*\n_{error['trace']}_\n\n"
|
||||
if len(new_text) > MAX_ERROR_TEXT:
|
||||
# `failure_text` here has length <= 3000
|
||||
failure_text = failure_text + "[Truncated]"
|
||||
@@ -728,7 +728,7 @@ class Message:
|
||||
if error["line"] in prev_error_lines:
|
||||
continue
|
||||
|
||||
new_text = f'{error["line"]}\n\n'
|
||||
new_text = f"{error['line']}\n\n"
|
||||
|
||||
if new_text not in all_failure_lines:
|
||||
all_failure_lines[new_text] = []
|
||||
@@ -794,7 +794,7 @@ class Message:
|
||||
job_result,
|
||||
failures,
|
||||
device,
|
||||
text=f'Number of failures: {job_result["failed"][device]}',
|
||||
text=f"Number of failures: {job_result['failed'][device]}",
|
||||
)
|
||||
|
||||
print("Sending the following reply")
|
||||
|
||||
@@ -152,7 +152,7 @@ class QuantizationMessage(Message):
|
||||
job_result,
|
||||
failures,
|
||||
device,
|
||||
text=f'Number of failures: {job_result["failed"][device]}',
|
||||
text=f"Number of failures: {job_result['failed'][device]}",
|
||||
)
|
||||
|
||||
print("Sending the following reply")
|
||||
@@ -203,7 +203,7 @@ if __name__ == "__main__":
|
||||
"job_link": {},
|
||||
}
|
||||
for quant in quantization_matrix
|
||||
if f"run_quantization_torch_gpu_{ quant }_test_reports" in available_artifacts
|
||||
if f"run_quantization_torch_gpu_{quant}_test_reports" in available_artifacts
|
||||
}
|
||||
|
||||
github_actions_jobs = get_jobs(
|
||||
@@ -220,7 +220,7 @@ if __name__ == "__main__":
|
||||
break
|
||||
|
||||
for quant in quantization_results.keys():
|
||||
for artifact_path in available_artifacts[f"run_quantization_torch_gpu_{ quant }_test_reports"].paths:
|
||||
for artifact_path in available_artifacts[f"run_quantization_torch_gpu_{quant}_test_reports"].paths:
|
||||
artifact = retrieve_artifact(artifact_path["path"], artifact_path["gpu"])
|
||||
if "stats" in artifact:
|
||||
# Link to the GitHub Action job
|
||||
|
||||
@@ -116,8 +116,8 @@ if __name__ == "__main__":
|
||||
|
||||
info = past_versions_testing[args.framework][args.version]
|
||||
|
||||
os.system(f'echo "export INSTALL_CMD=\'{info["install"]}\'" >> ~/.profile')
|
||||
print(f'echo "export INSTALL_CMD=\'{info["install"]}\'" >> ~/.profile')
|
||||
os.system(f"echo \"export INSTALL_CMD='{info['install']}'\" >> ~/.profile")
|
||||
print(f"echo \"export INSTALL_CMD='{info['install']}'\" >> ~/.profile")
|
||||
|
||||
cuda = ""
|
||||
if args.framework == "pytorch":
|
||||
|
||||
@@ -37,12 +37,12 @@ if __name__ == "__main__":
|
||||
for job in jobs:
|
||||
project_slug = job["project_slug"]
|
||||
if job["name"].startswith(("tests_", "examples_", "pipelines_")):
|
||||
url = f'https://circleci.com/api/v2/project/{project_slug}/{job["job_number"]}/artifacts'
|
||||
url = f"https://circleci.com/api/v2/project/{project_slug}/{job['job_number']}/artifacts"
|
||||
r = requests.get(url, headers={"Circle-Token": os.environ.get("CIRCLE_TOKEN", "")})
|
||||
job_artifacts = r.json()["items"]
|
||||
|
||||
os.makedirs(job["name"], exist_ok=True)
|
||||
os.makedirs(f'outputs/{job["name"]}', exist_ok=True)
|
||||
os.makedirs(f"outputs/{job['name']}", exist_ok=True)
|
||||
|
||||
job_test_summaries = {}
|
||||
for artifact in job_artifacts:
|
||||
@@ -67,7 +67,7 @@ if __name__ == "__main__":
|
||||
workflow_summary[job["name"]] = summary
|
||||
|
||||
# collected version
|
||||
with open(f'outputs/{job["name"]}/test_summary.json', "w") as fp:
|
||||
with open(f"outputs/{job['name']}/test_summary.json", "w") as fp:
|
||||
json.dump(summary, fp, indent=4)
|
||||
|
||||
new_workflow_summary = {}
|
||||
|
||||
@@ -247,7 +247,7 @@ def update_pipeline_and_auto_class_table(table: Dict[str, Tuple[str, str]]) -> D
|
||||
model_names.extend(list(name))
|
||||
|
||||
# Add pipeline tag and auto model class for those models
|
||||
table.update({model_name: (pipeline_tag, cls) for model_name in model_names})
|
||||
table.update(dict.fromkeys(model_names, (pipeline_tag, cls)))
|
||||
|
||||
return table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user