fix(frontend): use python-3.8 compatible syntax

This commit is contained in:
Alexandre Péré
2024-09-26 14:28:13 +02:00
committed by Quentin Bourgerie
parent ddb7bbeaf4
commit 7402219247
2 changed files with 21 additions and 2 deletions

View File

@@ -525,13 +525,13 @@ class Circuit:
# All Statistics
@property
def statistics(self) -> Dict: # pragma: no cover
def statistics(self) -> Dict:
"""
Get all statistics of the circuit.
"""
mod_stats = self._module.statistics
func_stats = mod_stats.pop("functions")[self._name]
return mod_stats | func_stats
return {**mod_stats, **func_stats}
@property
def configuration(self) -> Configuration:

View File

@@ -14,6 +14,25 @@ from concrete import fhe
from concrete.fhe import Client, ClientSpecs, EvaluationKeys, LookupTable, Server, Value
def test_circuit_statistics(helpers):
"""
Test circuit statistics has statistics from both module and func.
"""
configuration = helpers.configuration()
@fhe.compiler({"x": "encrypted", "y": "encrypted"})
def f(x, y):
return x + y
inputset = [(np.random.randint(0, 2**4), np.random.randint(0, 2**5)) for _ in range(100)]
circuit = f.compile(inputset, configuration.fork(p_error=6e-5))
stat = circuit.statistics
assert "p_error" in stat # from module
assert "size_of_inputs" in stat # from circuit
def test_circuit_str(helpers):
"""
Test `__str__` method of `Circuit` class.