Skip to content

Commit cb38d8e

Browse files
author
Kacper Kozubowski
committed
Add tree caching
1 parent 41f5fb9 commit cb38d8e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

skfp/fingerprints/klekota_roth/smarts_tree.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from dataclasses import dataclass, field
3+
from functools import lru_cache
34
from pathlib import Path
45

56
from rdkit import Chem
@@ -67,6 +68,7 @@ def _dict_to_node(d: dict, feature_names: list[str]) -> PatternNode:
6768
return node
6869

6970

71+
@lru_cache(maxsize=1)
7072
def _load_tree() -> tuple[PatternNode, list[str], dict[str, Mol]]:
7173
"""
7274
Load the pattern tree from a JSON file into internal representation.

0 commit comments

Comments
 (0)