Skip to content

Commit

Permalink
refactor: cache load_rules()
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed May 14, 2022
1 parent e28cdc6 commit d58361c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions abuse_whois/matchers/shared_hosting/rules.py
@@ -1,11 +1,13 @@
import pathlib
from functools import lru_cache
from typing import List

from abuse_whois.utils import load_yaml

from .rule import SharedHostingRule


@lru_cache(maxsize=1)
def load_rules() -> List[SharedHostingRule]:
rules: List[SharedHostingRule] = []
for path in pathlib.Path(__file__).parent.glob("./rules/*.yaml"):
Expand Down
2 changes: 2 additions & 0 deletions abuse_whois/matchers/whois/rules.py
@@ -1,11 +1,13 @@
import pathlib
from functools import lru_cache
from typing import List

from abuse_whois.utils import load_yaml

from .rule import WhoisRule


@lru_cache(maxsize=1)
def load_rules() -> List[WhoisRule]:
rules: List[WhoisRule] = []
for path in pathlib.Path(__file__).parent.glob("./rules/*.yaml"):
Expand Down

0 comments on commit d58361c

Please sign in to comment.