This loads the variables and attributes simultaneously. A centralized loading function makes it easier to create data stores that do automatic encoding/decoding. For example:: class SuffixAppendingDataStore(AbstractDataStore): def load(s
(self)
| 349 | return {} |
| 350 | |
| 351 | def load(self): |
| 352 | """ |
| 353 | This loads the variables and attributes simultaneously. |
| 354 | A centralized loading function makes it easier to create |
| 355 | data stores that do automatic encoding/decoding. |
| 356 | |
| 357 | For example:: |
| 358 | |
| 359 | class SuffixAppendingDataStore(AbstractDataStore): |
| 360 | def load(self): |
| 361 | variables, attributes = AbstractDataStore.load(self) |
| 362 | variables = {"%s_suffix" % k: v for k, v in variables.items()} |
| 363 | attributes = {"%s_suffix" % k: v for k, v in attributes.items()} |
| 364 | return variables, attributes |
| 365 | |
| 366 | This function will be called anytime variables or attributes |
| 367 | are requested, so care should be taken to make sure its fast. |
| 368 | """ |
| 369 | variables = FrozenDict( |
| 370 | (_decode_variable_name(k), v) for k, v in self.get_variables().items() |
| 371 | ) |
| 372 | attributes = FrozenDict(self.get_attrs()) |
| 373 | return variables, attributes |
| 374 | |
| 375 | def close(self): |
| 376 | pass |
no test coverage detected