mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Remove all functools lru cache (#3446)
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import lru_cache
|
|
||||||
from typing import Dict, List, Set, Tuple
|
from typing import Dict, List, Set, Tuple
|
||||||
|
|
||||||
|
from Utils import cache_argsless
|
||||||
|
|
||||||
from .item_definition_classes import (
|
from .item_definition_classes import (
|
||||||
CATEGORY_NAME_MAPPINGS,
|
CATEGORY_NAME_MAPPINGS,
|
||||||
DoorItemDefinition,
|
DoorItemDefinition,
|
||||||
@@ -260,17 +261,17 @@ def get_parent_progressive_item(item_name: str) -> str:
|
|||||||
return _progressive_lookup.get(item_name, item_name)
|
return _progressive_lookup.get(item_name, item_name)
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
@cache_argsless
|
||||||
def get_vanilla() -> StaticWitnessLogicObj:
|
def get_vanilla() -> StaticWitnessLogicObj:
|
||||||
return StaticWitnessLogicObj(get_vanilla_logic())
|
return StaticWitnessLogicObj(get_vanilla_logic())
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
@cache_argsless
|
||||||
def get_sigma_normal() -> StaticWitnessLogicObj:
|
def get_sigma_normal() -> StaticWitnessLogicObj:
|
||||||
return StaticWitnessLogicObj(get_sigma_normal_logic())
|
return StaticWitnessLogicObj(get_sigma_normal_logic())
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
@cache_argsless
|
||||||
def get_sigma_expert() -> StaticWitnessLogicObj:
|
def get_sigma_expert() -> StaticWitnessLogicObj:
|
||||||
return StaticWitnessLogicObj(get_sigma_expert_logic())
|
return StaticWitnessLogicObj(get_sigma_expert_logic())
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
from functools import lru_cache
|
|
||||||
from math import floor
|
from math import floor
|
||||||
from pkgutil import get_data
|
from pkgutil import get_data
|
||||||
from random import random
|
from random import random
|
||||||
@@ -103,10 +102,15 @@ def parse_lambda(lambda_string) -> WitnessRule:
|
|||||||
return lambda_set
|
return lambda_set
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
_adjustment_file_cache = dict()
|
||||||
|
|
||||||
|
|
||||||
def get_adjustment_file(adjustment_file: str) -> List[str]:
|
def get_adjustment_file(adjustment_file: str) -> List[str]:
|
||||||
data = get_data(__name__, adjustment_file).decode("utf-8")
|
if adjustment_file not in _adjustment_file_cache:
|
||||||
return [line.strip() for line in data.split("\n")]
|
data = get_data(__name__, adjustment_file).decode("utf-8")
|
||||||
|
_adjustment_file_cache[adjustment_file] = [line.strip() for line in data.split("\n")]
|
||||||
|
|
||||||
|
return _adjustment_file_cache[adjustment_file]
|
||||||
|
|
||||||
|
|
||||||
def get_disable_unrandomized_list() -> List[str]:
|
def get_disable_unrandomized_list() -> List[str]:
|
||||||
|
Reference in New Issue
Block a user