yutipy 2.4.1__py3-none-any.whl → 2.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of yutipy might be problematic. Click here for more details.
- yutipy/utils/helpers.py +14 -0
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/METADATA +6 -6
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/RECORD +7 -7
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/WHEEL +0 -0
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/entry_points.txt +0 -0
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/licenses/LICENSE +0 -0
- {yutipy-2.4.1.dist-info → yutipy-2.4.3.dist-info}/top_level.txt +0 -0
yutipy/utils/helpers.py
CHANGED
|
@@ -10,6 +10,18 @@ kakasi = pykakasi.kakasi()
|
|
|
10
10
|
TRANSLATION_CACHE = {}
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
def clear_translation_cache(limit: int = 25):
|
|
14
|
+
"""
|
|
15
|
+
Clear the translation cache if it reaches provided limit.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
limit (int, optional): The maximum limit of items in translation cache. Default is `25`.
|
|
19
|
+
"""
|
|
20
|
+
items = len(TRANSLATION_CACHE)
|
|
21
|
+
if items >= limit:
|
|
22
|
+
TRANSLATION_CACHE.clear()
|
|
23
|
+
|
|
24
|
+
|
|
13
25
|
def similarity(str1: str, str2: str, threshold: int = 100):
|
|
14
26
|
similarity_score = fuzz.WRatio(str1, str2, processor=default_process)
|
|
15
27
|
return similarity_score >= threshold
|
|
@@ -97,6 +109,8 @@ def are_strings_similar(
|
|
|
97
109
|
a. if both same, return True.
|
|
98
110
|
4. return False.
|
|
99
111
|
"""
|
|
112
|
+
# Clear translation cache if limit reached
|
|
113
|
+
clear_translation_cache()
|
|
100
114
|
|
|
101
115
|
# ### Step 0 ####
|
|
102
116
|
cached_str1 = TRANSLATION_CACHE.get(str1, str1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yutipy
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.3
|
|
4
4
|
Summary: A simple Python package to interact with various music platforms APIs.
|
|
5
5
|
Author: Cheap Nightbot
|
|
6
6
|
Author-email: Cheap Nightbot <hi@cheapnightbot.slmail.me>
|
|
@@ -25,11 +25,11 @@ Classifier: Operating System :: OS Independent
|
|
|
25
25
|
Requires-Python: >=3.9
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: pykakasi
|
|
29
|
-
Requires-Dist: python-dotenv
|
|
30
|
-
Requires-Dist: rapidfuzz
|
|
31
|
-
Requires-Dist: requests
|
|
32
|
-
Requires-Dist: ytmusicapi
|
|
28
|
+
Requires-Dist: pykakasi>=2.3.0
|
|
29
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
30
|
+
Requires-Dist: rapidfuzz>=3.13.0
|
|
31
|
+
Requires-Dist: requests>=2.32.5
|
|
32
|
+
Requires-Dist: ytmusicapi>=1.10.3
|
|
33
33
|
Dynamic: license-file
|
|
34
34
|
|
|
35
35
|
<p align="center">
|
|
@@ -16,10 +16,10 @@ yutipy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
16
16
|
yutipy/cli/config.py,sha256=e5RIq6RxVxxzx30nKVMa06gwyQ258s7U0WA1xvJuR_0,4543
|
|
17
17
|
yutipy/cli/search.py,sha256=8SQw0bjRzRqAg-FuVz9aWjB2KBZqmCf38SyKAQ3rx5E,3025
|
|
18
18
|
yutipy/utils/__init__.py,sha256=AZaqvs6AJwnqwJuodbGnHu702WSUqc8plVC16SppOcU,239
|
|
19
|
-
yutipy/utils/helpers.py,sha256=
|
|
20
|
-
yutipy-2.4.
|
|
21
|
-
yutipy-2.4.
|
|
22
|
-
yutipy-2.4.
|
|
23
|
-
yutipy-2.4.
|
|
24
|
-
yutipy-2.4.
|
|
25
|
-
yutipy-2.4.
|
|
19
|
+
yutipy/utils/helpers.py,sha256=xvldSP4SCstkBz4x7HGsjybVbE-7NCOplLH1aMJuumc,7837
|
|
20
|
+
yutipy-2.4.3.dist-info/licenses/LICENSE,sha256=_89JsS2QnBG8tAb5-VWbJDj_uJ002zPJAYBJJdh3DPY,1071
|
|
21
|
+
yutipy-2.4.3.dist-info/METADATA,sha256=I5Zz2FMr1vTZw91uMfi7cuOdj7gwSzd-gpVzsR_4INM,6620
|
|
22
|
+
yutipy-2.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
yutipy-2.4.3.dist-info/entry_points.txt,sha256=BrgmanaPjQqKQ3Ip76JLcsPgGANtrBSURf5CNIxl1HA,106
|
|
24
|
+
yutipy-2.4.3.dist-info/top_level.txt,sha256=t2A5V2_mUcfnHkbCy6tAQlb3909jDYU5GQgXtA4756I,7
|
|
25
|
+
yutipy-2.4.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|