Calculate all of the children representing metadata. From the children in the path, calculate early all of the children that appear to represent metadata (infos) or legacy metadata (eggs).
(self, path: FastPath)
| 879 | """ |
| 880 | |
| 881 | def __init__(self, path: FastPath): |
| 882 | """ |
| 883 | Calculate all of the children representing metadata. |
| 884 | |
| 885 | From the children in the path, calculate early all of the |
| 886 | children that appear to represent metadata (infos) or legacy |
| 887 | metadata (eggs). |
| 888 | """ |
| 889 | |
| 890 | base = os.path.basename(path.root).lower() |
| 891 | base_is_egg = base.endswith(".egg") |
| 892 | self.infos = FreezableDefaultDict(list) |
| 893 | self.eggs = FreezableDefaultDict(list) |
| 894 | |
| 895 | for child in path.children(): |
| 896 | low = child.lower() |
| 897 | if low.endswith((".dist-info", ".egg-info")): |
| 898 | # rpartition is faster than splitext and suitable for this purpose. |
| 899 | name = low.rpartition(".")[0].partition("-")[0] |
| 900 | normalized = Prepared.normalize(name) |
| 901 | self.infos[normalized].append(path.joinpath(child)) |
| 902 | elif base_is_egg and low == "egg-info": |
| 903 | name = base.rpartition(".")[0].partition("-")[0] |
| 904 | legacy_normalized = Prepared.legacy_normalize(name) |
| 905 | self.eggs[legacy_normalized].append(path.joinpath(child)) |
| 906 | |
| 907 | self.infos.freeze() |
| 908 | self.eggs.freeze() |
| 909 | |
| 910 | def search(self, prepared: Prepared): |
| 911 | """ |
nothing calls this directly
no test coverage detected