MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / check_files

Function check_files

scripts/utils/check-dist.py:186–208  ·  view source on GitHub ↗

`allowed` gives the committed path of each file's name in the archive

(
    archive: str,
    members: list[Member],
    committed: dict[str, Committed],
    allowed: dict[str, str],
    required: set[str],
)

Source from the content-addressed store, hash-verified

184
185
186def check_files(
187 archive: str,
188 members: list[Member],
189 committed: dict[str, Committed],
190 allowed: dict[str, str],
191 required: set[str],
192) -> dict[str, bytes]:
193 """`allowed` gives the committed path of each file's name in the archive"""
194 for name, count in Counter(member.name for member in members).items():
195 if count > 1:
196 problems.append(f"{archive}: {name} is there {count} times")
197
198 for member in members:
199 if member.name in allowed:
200 path = allowed[member.name]
201 if committed[path] != (git_hash(member.data), member.executable):
202 problems.append(f"{archive}: {member.name} differs from the commit's {path}")
203 elif member.name not in required:
204 problems.append(f"{archive}: {member.name} is not in the commit")
205
206 contents = {member.name: member.data for member in members}
207 problems.extend(f"{archive}: {name} is missing" for name in sorted(required - contents.keys()))
208 return contents
209
210
211def check_wheel(path: Path, package: str, pyproject: dict[str, Any], committed: dict[str, Committed]) -> bytes:

Callers 2

check_wheelFunction · 0.85
check_sdistFunction · 0.85

Calls 3

CounterClass · 0.85
git_hashFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected