mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
refactor(frontend): change location format
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
"""Compilation feedback."""
|
||||
|
||||
import re
|
||||
from typing import Dict, Set
|
||||
|
||||
# pylint: disable=no-name-in-module,import-error,too-many-instance-attributes
|
||||
@@ -19,6 +20,10 @@ from .parameter import Parameter
|
||||
from .wrapper import WrapperCpp
|
||||
|
||||
|
||||
# matches (@tag, separator( | ), filename)
|
||||
REGEX_LOCATION = r"loc\(\"(@[\w\.]+)?( \| )?(.+)\""
|
||||
|
||||
|
||||
class CompilationFeedback(WrapperCpp):
|
||||
"""CompilationFeedback is a set of hint computed by the compiler engine."""
|
||||
|
||||
@@ -130,8 +135,9 @@ class CompilationFeedback(WrapperCpp):
|
||||
if statistic.operation not in operations:
|
||||
continue
|
||||
|
||||
file_and_maybe_tag = statistic.location.split("@")
|
||||
tag = "" if len(file_and_maybe_tag) == 1 else file_and_maybe_tag[1].strip()
|
||||
tag, _, _ = re.match(REGEX_LOCATION, statistic.location).groups()
|
||||
# remove the @
|
||||
tag = tag[1:] if tag else ""
|
||||
|
||||
tag_components = tag.split(".")
|
||||
for i in range(1, len(tag_components) + 1):
|
||||
@@ -176,8 +182,9 @@ class CompilationFeedback(WrapperCpp):
|
||||
if statistic.operation not in operations:
|
||||
continue
|
||||
|
||||
file_and_maybe_tag = statistic.location.split("@")
|
||||
tag = "" if len(file_and_maybe_tag) == 1 else file_and_maybe_tag[1].strip()
|
||||
tag, _, _ = re.match(REGEX_LOCATION, statistic.location).groups()
|
||||
# remove the @
|
||||
tag = tag[1:] if tag else ""
|
||||
|
||||
tag_components = tag.split(".")
|
||||
for i in range(1, len(tag_components) + 1):
|
||||
|
||||
Reference in New Issue
Block a user