Cover matcher and API scenarios

This commit is contained in:
Fiden committed 2026-08-07 13:15:43 +00:00
1 parent a67826daa4
commit 11e1a4c4a2
7 files changed
+265 -4

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ PRODUCT_ALIASES = [
},
{
"canonical": "круг",
"aliases": ["круг шлифовальный", "шлифовальный круг", "круг на липучке"],
"aliases": ["круг", "круг шлифовальный", "шлифовальный круг", "круг на липучке"],
},
{"canonical": "дрель", "aliases": ["дрель", "дрели", "ударная дрель"]},
{"canonical": "лобзик", "aliases": ["лобзик", "электролобзик"]},
+5 -3
View File
@@ -426,6 +426,9 @@ def parse_attributes(
if not catalog_item and "метровая" in normalized and not meter_values:
meter_values.append(Decimal("1"))
pack_match = (_CATALOG_PACK_RE if catalog_item else _PACK_SIZE_RE).search(normalized)
pack_size = int(pack_match.group(1)) if pack_match else None
bare_size_types = {
"ушм",
"диск",
@@ -453,6 +456,8 @@ def parse_attributes(
]
if teeth is not None:
bare_numbers = [value for value in bare_numbers if value != Decimal(teeth)]
if pack_size is not None:
bare_numbers = [value for value in bare_numbers if value != Decimal(pack_size)]
if bare_numbers:
mm_values.append(bare_numbers[0])
@@ -481,9 +486,6 @@ def parse_attributes(
power_match = _POWER_RE.search(normalized)
power_w = _decimal(power_match.group(1)) if power_match else None
pack_match = (_CATALOG_PACK_RE if catalog_item else _PACK_SIZE_RE).search(normalized)
pack_size = int(pack_match.group(1)) if pack_match else None
unit_hint: str | None = None
if not catalog_item:
if re.search(r"\b(?:пачк\w*|упаковк\w*|уп\.)\b", normalized):