From 0f053e66817e02b46a6d210b66aa52f79ae2763d Mon Sep 17 00:00:00 2001 From: jrudz Date: Wed, 10 Jul 2024 16:00:31 +0200 Subject: [PATCH] fixed norm in schema plugins --- docs/schema_plugins.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/schema_plugins.md b/docs/schema_plugins.md index 28ccd34..1b8073e 100644 --- a/docs/schema_plugins.md +++ b/docs/schema_plugins.md @@ -47,9 +47,6 @@ Suppose you are developing a parser for a well-defined schema specified within t ``` hdf5_schema +-- version: Integer[3] - \-- author - | +-- name: String[] - | +-- (email: String[]) \-- hdf5_generator | +-- name: String[] | +-- version: String[] @@ -410,13 +407,17 @@ The normalization function within each schema section definition allows us to pe if not self.contributions: return + value = self.value + unknown_energy_exists = False for contribution in self.contributions: if not contribution.value: continue - value = self.value - contribution.value - self.contributions.append(UnknownEnergy(value=value)) - + if contribution.name == 'UnknownEnergy': + unknown_energy_exists = True + value -= contribution.value + if not unknown_energy_exists: + self.contributions.append(UnknownEnergy(value=value)) ``` !!! abstract "Assignment 4.6"