MCPcopy
hub / github.com/pyodide/pyodide / filterfunc

Function filterfunc

tools/create_zipfile.py:45–69  ·  view source on GitHub ↗
(path: Path | str, names: list[str])

Source from the content-addressed store, hash-verified

43 return False
44
45 def filterfunc(path: Path | str, names: list[str]) -> set[str]:
46 filtered_files = {(root / f).resolve() for f in excludes}
47
48 # We have JS implementations of these modules, so we don't need to
49 # include the Python ones. Checking the name of the root directory
50 # is a bit of a hack, but it works...
51 if root.name.startswith("python3"):
52 filtered_files.update({root / f for f in stubs})
53
54 path = Path(path).resolve()
55
56 if _should_skip(path):
57 return set(names)
58
59 _names = []
60 for name in names:
61 fullpath = path / name
62
63 if _should_skip(fullpath) or fullpath in filtered_files:
64 if verbose:
65 print(f"Skipping {fullpath}")
66
67 _names.append(name)
68
69 return set(_names)
70
71 return filterfunc
72

Callers 1

test_defaultfilterfuncFunction · 0.85

Calls 4

_should_skipFunction · 0.85
setFunction · 0.85
updateMethod · 0.80
appendMethod · 0.45

Tested by 1

test_defaultfilterfuncFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…