Unverified Commit b256516a authored by Arthur's avatar Arthur Committed by GitHub
Browse files

[`make fix-copies`] update and help (#29924)

* add some help

* style
parent d9dc993f
...@@ -309,7 +309,16 @@ def split_code_into_blocks( ...@@ -309,7 +309,16 @@ def split_code_into_blocks(
""" """
splits = [] splits = []
# `indent - 4` is the indent level of the target class/func header # `indent - 4` is the indent level of the target class/func header
target_block_name = re.search(rf"^{' ' * (indent - 4)}((class|def)\s+\S+)(\(|\:)", lines[start_index]).groups()[0] try:
target_block_name = re.search(
rf"^{' ' * (indent - 4)}((class|def)\s+\S+)(\(|\:)", lines[start_index]
).groups()[0]
except ValueError:
raise ValueError(
f"Tried to split a class or function. It did not work. Error comes from line {start_index}: ```\n"
+ "".join(lines[start_index:end_index])
+ "```\n"
)
# from now on, the `block` means inner blocks unless explicitly specified # from now on, the `block` means inner blocks unless explicitly specified
indent_str = " " * indent indent_str = " " * indent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment