Skip to content

Commit 1578579

Browse files
SimonHeybrockjl-wynen
authored andcommitted
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 20e3807 commit 1578579

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:
@@ -25,6 +26,7 @@ def __init__(
2526
def __contains__(self, key):
2627
return key in self._registry.registry
2728

29+
@cache # noqa: B019
2830
def get_path(self, name: str, unzip: bool = False) -> str:
2931
"""
3032
Get the path to a file in the registry.

0 commit comments

Comments
 (0)