Method
__getitem__
(self, k: Union[int, str])
Source from the content-addressed store, hash-verified
| 118 | return [ref for ref in self.database.refs if ref.table1 == self] |
| 119 | |
| 120 | def __getitem__(self, k: Union[int, str]) -> Column: |
| 121 | if isinstance(k, int): |
| 122 | return self.columns[k] |
| 123 | elif isinstance(k, str): |
| 124 | for c in self.columns: |
| 125 | if c.name == k: |
| 126 | return c |
| 127 | raise ColumnNotFoundError(f'Column {k} not present in table {self.name}') |
| 128 | else: |
| 129 | raise TypeError('indeces must be str or int') |
| 130 | |
| 131 | def get(self, k, default: Optional[Column] = None) -> Optional[Column]: |
| 132 | try: |
Tested by
no test coverage detected