MCPcopy Index your code
hub / github.com/python/mypy / slot_key

Function slot_key

mypyc/codegen/emitclass.py:167–174  ·  view source on GitHub ↗

Map dunder method name to sort key. Sort reverse operator methods and __delitem__ after others ('x' > '_').

(attr: str)

Source from the content-addressed store, hash-verified

165
166
167def slot_key(attr: str) -> str:
168 """Map dunder method name to sort key.
169
170 Sort reverse operator methods and __delitem__ after others ('x' > '_').
171 """
172 if (attr.startswith("__r") and attr != "__rshift__") or attr == "__delitem__":
173 return "x" + attr
174 return attr
175
176
177def generate_slots(cl: ClassIR, table: SlotTable, emitter: Emitter) -> dict[str, str]:

Callers 2

test_slot_keyMethod · 0.90
generate_slotsFunction · 0.85

Calls 1

startswithMethod · 0.45

Tested by 1

test_slot_keyMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…