Skip to content

Commit dc438ae

Browse files
committed
Cache paths returned from Pooch to avoid repeated checksum in unit tests
This seems to save, e.g., 0.3 seconds a whole bunch of times. Not huge but noticeable. Is it a good idea?
1 parent f024812 commit dc438ae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ess/sans/data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
3+
from functools import cache
34

45

56
class Registry:
@@ -18,6 +19,7 @@ def __init__(self, instrument: str, files: dict[str, str], version: str):
1819
def __contains__(self, key):
1920
return key in self._registry.registry
2021

22+
@cache # noqa: B019
2123
def get_path(self, name: str, unzip: bool = False) -> str:
2224
"""
2325
Get the path to a file in the registry.

0 commit comments

Comments
 (0)