MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/importlib/metadata/__init__.py:775–802  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

773 """
774
775 def __init__(self, path: FastPath):
776 """
777 Calculate all of the children representing metadata.
778
779 From the children in the path, calculate early all of the
780 children that appear to represent metadata (infos) or legacy
781 metadata (eggs).
782 """
783
784 base = os.path.basename(path.root).lower()
785 base_is_egg = base.endswith(".egg")
786 self.infos = FreezableDefaultDict(list)
787 self.eggs = FreezableDefaultDict(list)
788
789 for child in path.children():
790 low = child.lower()
791 if low.endswith((".dist-info", ".egg-info")):
792 # rpartition is faster than splitext and suitable for this purpose.
793 name = low.rpartition(".")[0].partition("-")[0]
794 normalized = Prepared.normalize(name)
795 self.infos[normalized].append(path.joinpath(child))
796 elif base_is_egg and low == "egg-info":
797 name = base.rpartition(".")[0].partition("-")[0]
798 legacy_normalized = Prepared.legacy_normalize(name)
799 self.eggs[legacy_normalized].append(path.joinpath(child))
800
801 self.infos.freeze()
802 self.eggs.freeze()
803
804 def search(self, prepared: Prepared):
805 """

Callers

nothing calls this directly

Calls 12

basenameMethod · 0.80
legacy_normalizeMethod · 0.80
lowerMethod · 0.45
endswithMethod · 0.45
childrenMethod · 0.45
partitionMethod · 0.45
rpartitionMethod · 0.45
normalizeMethod · 0.45
appendMethod · 0.45
joinpathMethod · 0.45
freezeMethod · 0.45

Tested by

no test coverage detected