MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / OrderedSet

Class OrderedSet

tools/ports/__init__.py:453–482  ·  view source on GitHub ↗

Partial implementation of OrderedSet. Just enough for what we need here.

Source from the content-addressed store, hash-verified

451
452
453class OrderedSet:
454 """Partial implementation of OrderedSet. Just enough for what we need here."""
455
456 def __init__(self, items):
457 self.dict = {}
458 for i in items:
459 self.dict[i] = True
460
461 def __repr__(self):
462 return f"OrderedSet({list(self.dict.keys())})"
463
464 def __len__(self):
465 return len(self.dict.keys())
466
467 def copy(self):
468 return OrderedSet(self.dict.keys())
469
470 def __iter__(self):
471 return iter(self.dict.keys())
472
473 def pop(self, index=-1):
474 key = list(self.dict.keys())[index]
475 self.dict.pop(key)
476 return key
477
478 def add(self, item):
479 self.dict[item] = True
480
481 def remove(self, item):
482 del self.dict[item]
483
484
485def dependency_order(port_list):

Callers 4

copyMethod · 0.85
dependency_orderFunction · 0.85
get_needed_portsFunction · 0.85
build_portFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected