MCPcopy
hub / github.com/PyCQA/isort / search

Method search

isort/utils.py:39–59  ·  view source on GitHub ↗

Returns the closest config relative to filename by doing a depth first search on the prefix tree.

(self, filename: str)

Source from the content-addressed store, hash-verified

37 temp.config_info = (config_file, config_data)
38
39 def search(self, filename: str) -> tuple[str, dict[str, Any]]:
40 """
41 Returns the closest config relative to filename by doing a depth
42 first search on the prefix tree.
43 """
44 resolved_file_path_as_tuple = Path(filename).resolve().parts
45
46 temp = self.root
47
48 last_stored_config: tuple[str, dict[str, Any]] = ("", {})
49
50 for path in resolved_file_path_as_tuple:
51 if temp.config_info[0]:
52 last_stored_config = temp.config_info
53
54 if path not in temp.nodes:
55 break
56
57 temp = temp.nodes[path]
58
59 return last_stored_config
60
61
62@lru_cache(maxsize=1000)

Callers 5

test_trieFunction · 0.95
check_fileFunction · 0.80
sort_fileFunction · 0.80
lineFunction · 0.80
test_find_all_configsFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_trieFunction · 0.76
test_find_all_configsFunction · 0.64