MCPcopy Create free account
hub / github.com/davidblewett/rure-python / iter_crates

Function iter_crates

regex/scripts/scrape_crates_io.py:100–113  ·  view source on GitHub ↗
(crates_index)

Source from the content-addressed store, hash-verified

98
99
100def iter_crates(crates_index):
101 exclude = set(["config.json", ".git"])
102 for crate_index_file in iter_files(crates_index, exclude=exclude):
103 with open(crate_index_file) as f:
104 most_recent = list(f)
105 most_recent = most_recent[len(most_recent) - 1]
106
107 crate_info = json.loads(most_recent)
108 if "regex" not in set(d["name"] for d in crate_info["deps"]):
109 continue
110
111 if crate_info["yanked"]:
112 continue
113 yield (crate_info["name"], crate_info["vers"])
114
115
116def iter_files(d, exclude=set()):

Callers 1

mainFunction · 0.85

Calls 1

iter_filesFunction · 0.85

Tested by

no test coverage detected