MCPcopy
hub / github.com/HIT-SCIR/ltp / __getitem__

Method __getitem__

python/interface/ltp/generic.py:82–87  ·  view source on GitHub ↗
(self, k)

Source from the content-addressed store, hash-verified

80 raise Exception(f"You cannot use ``update`` on a {self.__class__.__name__} instance.")
81
82 def __getitem__(self, k):
83 if isinstance(k, str):
84 inner_dict = {k: v for (k, v) in self.items()}
85 return inner_dict[k]
86 else:
87 return self.to_tuple()[k]
88
89 def __setattr__(self, name, value):
90 if name in self.keys() and value is not None:

Callers

nothing calls this directly

Calls 1

to_tupleMethod · 0.95

Tested by

no test coverage detected