自然排序键函数
(path: Path)
| 14 | |
| 15 | |
| 16 | def natural_sort_key(path: Path) -> tuple: |
| 17 | """自然排序键函数""" |
| 18 | parts = re.split(r'(\d+)', path.name) |
| 19 | result = [] |
| 20 | for part in parts: |
| 21 | try: |
| 22 | result.append(int(part)) |
| 23 | except ValueError: |
| 24 | result.append(part) |
| 25 | return tuple(result) |
| 26 | |
| 27 | |
| 28 | def read_json_file(file_path: Path) -> list: |
nothing calls this directly
no outgoing calls
no test coverage detected