MCPcopy Create free account
hub / github.com/cdgriffith/Box / __init__

Method __init__

box/box_list.py:52–66  ·  view source on GitHub ↗
(self, iterable: Iterable | None = None, box_class: type[box.Box] = box.Box, **box_options)

Source from the content-addressed store, hash-verified

50 return obj
51
52 def __init__(self, iterable: Iterable | None = None, box_class: type[box.Box] = box.Box, **box_options):
53 self.box_options = box_options
54 self.box_options["box_class"] = box_class
55 self.box_org_ref = iterable
56 if iterable:
57 for x in iterable:
58 self.append(x)
59 self.box_org_ref = None
60 if box_options.get("frozen_box"):
61
62 def frozen(*args, **kwargs):
63 raise BoxError("BoxList is frozen")
64
65 for method in ["append", "extend", "insert", "pop", "remove", "reverse", "sort"]:
66 self.__setattr__(method, frozen)
67
68 def __getitem__(self, item):
69 if self.box_options.get("box_dots") and isinstance(item, str) and item.startswith("["):

Callers

nothing calls this directly

Calls 3

appendMethod · 0.95
getMethod · 0.80
__setattr__Method · 0.80

Tested by

no test coverage detected