(match)
| 187 | |
| 188 | # This inner function sort imports between [ ]. |
| 189 | def _replace(match): |
| 190 | imports = match.groups()[0] |
| 191 | # If there is one import only, nothing to do. |
| 192 | if "," not in imports: |
| 193 | return f"[{imports}]" |
| 194 | keys = [part.strip().replace('"', "") for part in imports.split(",")] |
| 195 | # We will have a final empty element if the line finished with a comma. |
| 196 | if len(keys[-1]) == 0: |
| 197 | keys = keys[:-1] |
| 198 | return "[" + ", ".join([f'"{k}"' for k in sort_objects(keys)]) + "]" |
| 199 | |
| 200 | lines = import_statement.split("\n") |
| 201 | if len(lines) > 3: |
nothing calls this directly
no test coverage detected