feat: added lru cache to unify function to speed up indexing
This commit is contained in:
		@@ -7,7 +7,7 @@ logging.getLogger().setLevel(logging.DEBUG)
 | 
				
			|||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    commands = [
 | 
					    commands = [
 | 
				
			||||||
        "s: #a Ghost Bath",
 | 
					        "s: #a Ghost Bath",
 | 
				
			||||||
        "4",
 | 
					        "d: 0",
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ from ..pages import Page, EncyclopaediaMetallum, Musify, YouTube, YoutubeMusic,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ALL_PAGES: Set[Type[Page]] = {
 | 
					ALL_PAGES: Set[Type[Page]] = {
 | 
				
			||||||
    EncyclopaediaMetallum,
 | 
					    # EncyclopaediaMetallum,
 | 
				
			||||||
    Musify,
 | 
					    Musify,
 | 
				
			||||||
    YoutubeMusic,
 | 
					    YoutubeMusic,
 | 
				
			||||||
    Bandcamp
 | 
					    Bandcamp
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ DEBUG_LOGGING = DEBUG and True
 | 
				
			|||||||
DEBUG_TRACE = DEBUG and True
 | 
					DEBUG_TRACE = DEBUG and True
 | 
				
			||||||
DEBUG_OBJECT_TRACE = DEBUG and False
 | 
					DEBUG_OBJECT_TRACE = DEBUG and False
 | 
				
			||||||
DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
 | 
					DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
 | 
				
			||||||
DEBUG_PAGES = DEBUG and False
 | 
					DEBUG_PAGES = DEBUG and True
 | 
				
			||||||
DEBUG_DUMP = DEBUG and True
 | 
					DEBUG_DUMP = DEBUG and True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if DEBUG:
 | 
					if DEBUG:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
from typing import Tuple, Union
 | 
					from typing import Tuple, Union
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
import string
 | 
					import string
 | 
				
			||||||
 | 
					from functools import lru_cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from transliterate.exceptions import LanguageDetectionError
 | 
					from transliterate.exceptions import LanguageDetectionError
 | 
				
			||||||
from transliterate import translit
 | 
					from transliterate import translit
 | 
				
			||||||
@@ -11,7 +12,7 @@ COMMON_TITLE_APPENDIX_LIST: Tuple[str, ...] = (
 | 
				
			|||||||
    "(official video)",
 | 
					    "(official video)",
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@lru_cache
 | 
				
			||||||
def unify(string: str) -> str:
 | 
					def unify(string: str) -> str:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    returns a unified str, to make comparisons easy.
 | 
					    returns a unified str, to make comparisons easy.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user