(self)
| 266 | return (key in self._files or key in self.files) |
| 267 | |
| 268 | def __repr__(self): |
| 269 | # Get filename or default to `object` |
| 270 | if isinstance(self.fid, str): |
| 271 | filename = self.fid |
| 272 | else: |
| 273 | filename = getattr(self.fid, "name", "object") |
| 274 | |
| 275 | # Get the name of arrays |
| 276 | array_names = ', '.join(self.files[:self._MAX_REPR_ARRAY_COUNT]) |
| 277 | if len(self.files) > self._MAX_REPR_ARRAY_COUNT: |
| 278 | array_names += "..." |
| 279 | return f"NpzFile {filename!r} with keys: {array_names}" |
| 280 | |
| 281 | |
| 282 | @set_module('numpy') |