Skip to content

Commit b694531

Browse files
authored
refactor: custom_init_isort readability fixups (#631)
Signed-off-by: Ryan Russell <[email protected]> Signed-off-by: Ryan Russell <[email protected]>
1 parent b671cb0 commit b694531

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/custom_init_isort.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def sort_imports(file, check_only=True):
200200
indent = get_indent(block_lines[1])
201201
# Slit the internal block into blocks of indent level 1.
202202
internal_blocks = split_code_in_indented_blocks(internal_block_code, indent_level=indent)
203-
# We have two categories of import key: list or _import_structu[key].append/extend
203+
# We have two categories of import key: list or _import_structure[key].append/extend
204204
pattern = _re_direct_key if "_import_structure" in block_lines[0] else _re_indirect_key
205205
# Grab the keys, but there is a trap: some lines are empty or just comments.
206206
keys = [(pattern.search(b).groups()[0] if pattern.search(b) is not None else None) for b in internal_blocks]
@@ -210,17 +210,17 @@ def sort_imports(file, check_only=True):
210210

211211
# We reorder the blocks by leaving empty lines/comments as they were and reorder the rest.
212212
count = 0
213-
reorderded_blocks = []
213+
reordered_blocks = []
214214
for i in range(len(internal_blocks)):
215215
if keys[i] is None:
216-
reorderded_blocks.append(internal_blocks[i])
216+
reordered_blocks.append(internal_blocks[i])
217217
else:
218218
block = sort_objects_in_import(internal_blocks[sorted_indices[count]])
219-
reorderded_blocks.append(block)
219+
reordered_blocks.append(block)
220220
count += 1
221221

222222
# And we put our main block back together with its first and last line.
223-
main_blocks[block_idx] = "\n".join(block_lines[:line_idx] + reorderded_blocks + [block_lines[-1]])
223+
main_blocks[block_idx] = "\n".join(block_lines[:line_idx] + reordered_blocks + [block_lines[-1]])
224224

225225
if code != "\n".join(main_blocks):
226226
if check_only:

0 commit comments

Comments
 (0)