openadr3-client-gac-compliance 0.0.2__py3-none-any.whl → 1.1.0__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.
@@ -1,5 +1,6 @@
1
1
  from openadr3_client_gac_compliance.config import GAC_VERSION
2
2
 
3
- if GAC_VERSION == "3.0":
4
- import openadr3_client_gac_compliance.gac30.program_gac_compliant # noqa: F401
5
- import openadr3_client_gac_compliance.gac30.event_gac_compliant # noqa: F401
3
+ if GAC_VERSION == "2.0":
4
+ import openadr3_client_gac_compliance.gac20.program_gac_compliant # noqa: F401
5
+ import openadr3_client_gac_compliance.gac20.event_gac_compliant # noqa: F401
6
+ import openadr3_client_gac_compliance.gac20.ven_gac_compliant # noqa: F401
@@ -2,7 +2,7 @@
2
2
 
3
3
  from decouple import config
4
4
 
5
- VALID_GAC_VERSIONS: list[str] = ["3.0"]
5
+ VALID_GAC_VERSIONS: list[str] = ["2.0"]
6
6
 
7
7
 
8
8
  def _gac_version_cast(value: str) -> str:
@@ -23,4 +23,4 @@ def _gac_version_cast(value: str) -> str:
23
23
 
24
24
 
25
25
  # The GAC version to use for the compliance validators.
26
- GAC_VERSION = config("GAC_VERSION", default="3.0", cast=_gac_version_cast)
26
+ GAC_VERSION = config("GAC_VERSION", default="2.0", cast=_gac_version_cast)
@@ -0,0 +1,4 @@
1
+ # This module imports all the GAC 3.0 compliance validators.
2
+
3
+ import openadr3_client_gac_compliance.gac20.program_gac_compliant # noqa: F401
4
+ import openadr3_client_gac_compliance.gac20.event_gac_compliant # noqa: F401
@@ -182,16 +182,12 @@ def event_gac_compliant(self: Event) -> Event:
182
182
 
183
183
  GAC enforces the following constraints for events:
184
184
 
185
- - The event must have a priority set.
186
- - The priority must be greater than or equal to 0 and less than or equal to 999.
185
+ - The event must not have a priority set.
187
186
  - The event must have either a continuous or seperated interval definition.
188
187
  """
189
- if self.priority is None:
190
- raise ValueError("The event must have a priority set.")
191
-
192
- if self.priority > 999:
188
+ if self.priority is not None:
193
189
  raise ValueError(
194
- "The priority must be greater than or equal to 0 and less than or equal to 999."
190
+ "The event must not have a priority set for GAC 2.0 compliance"
195
191
  )
196
192
 
197
193
  interval_periods_validated = _continuous_or_seperated(self)
@@ -12,7 +12,7 @@ def program_gac_compliant(self: Program) -> Program:
12
12
 
13
13
  GAC enforces the following constraints for programs:
14
14
  - The program must have a retailer name
15
- - The retailer name must be an EAN13 identifier.
15
+ - The retailer name must be between 2 and 128 characters long.
16
16
  - The program MUST have a programType.
17
17
  - The programType MUST equal "DSO_CPO_INTERFACE-x.x.x, where x.x.x is the version as defined in the GAC specification.
18
18
  - The program MUST have bindingEvents set to True.
@@ -22,8 +22,9 @@ def program_gac_compliant(self: Program) -> Program:
22
22
 
23
23
  if self.retailer_name is None:
24
24
  raise ValueError("The program must have a retailer name.")
25
- if not re.fullmatch(r"\d{13}", self.retailer_name):
26
- raise ValueError("The retailer name must be an EAN13 identifier.")
25
+
26
+ if len(self.retailer_name) < 2 or len(self.retailer_name) > 128:
27
+ raise ValueError("The retailer name must be between 2 and 128 characters long.")
27
28
 
28
29
  if self.program_type is None:
29
30
  raise ValueError("The program must have a program type.")
@@ -0,0 +1,27 @@
1
+ import re
2
+ from openadr3_client.models.model import ValidatorRegistry, Model as ValidatorModel
3
+ from openadr3_client.models.ven.ven import Ven
4
+ import pycountry
5
+
6
+
7
+ @ValidatorRegistry.register(Ven, ValidatorModel())
8
+ def ven_gac_compliant(self: Ven) -> Ven:
9
+ """Enforces that the ven is GAC compliant.
10
+
11
+ GAC enforces the following constraints for vens:
12
+ - The ven must have a ven name
13
+ - The ven name must be an eMI3 identifier.
14
+ """
15
+ emi3_identifier_regex = r"^[A-Z]{2}-?[A-Z0-9]{3}$"
16
+
17
+ if not re.fullmatch(emi3_identifier_regex, self.ven_name):
18
+ raise ValueError("The ven name must be formatted as an eMI3 identifier.")
19
+
20
+ alpha_2_country = pycountry.countries.get(alpha_2=self.ven_name[:2])
21
+
22
+ if alpha_2_country is None:
23
+ raise ValueError(
24
+ "The first two characters of the ven name must be a valid ISO 3166-1 alpha-2 country code."
25
+ )
26
+
27
+ return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openadr3-client-gac-compliance
3
- Version: 0.0.2
3
+ Version: 1.1.0
4
4
  Summary:
5
5
  Author: Nick van der Burgt
6
6
  Author-email: nick.van.der.burgt@elaad.nl
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Programming Language :: Python :: 3.13
11
11
  Requires-Dist: openadr3-client (>=0.0.1,<0.0.2)
12
+ Requires-Dist: pycountry (>=24.6.1,<25.0.0)
12
13
  Requires-Dist: pydantic (>=2.11.2,<3.0.0)
13
14
  Description-Content-Type: text/markdown
14
15
 
@@ -0,0 +1,11 @@
1
+ openadr3_client_gac_compliance/__init__.py,sha256=dzf9YdOlssEb9GSIoThaMzEJ956G-hpLi7HIXRC3TR8,334
2
+ openadr3_client_gac_compliance/config.py,sha256=X_KEl99bUm05rH0IOKLyeR4Zn2utdC8U3vLkdG8MYXU,675
3
+ openadr3_client_gac_compliance/gac20/__init__.py,sha256=YPjRHMl-uR6ZwrDGjY_EboScHe_VhTrovso_zDOSd6o,220
4
+ openadr3_client_gac_compliance/gac20/event_gac_compliant.py,sha256=KPcUyazlroFv0c3IovvtMW4a4LD2lBOyct4ptjngixk,7970
5
+ openadr3_client_gac_compliance/gac20/program_gac_compliant.py,sha256=qJeyvAdu0f6F0I3iXXl64dOVRZwPfRHQyGqc3ECuzjw,1725
6
+ openadr3_client_gac_compliance/gac20/ven_gac_compliant.py,sha256=YAzM2Q9ggh_O-p1xD5GlN7-lTGg2MjqUG26KBSy3-d8,908
7
+ openadr3_client_gac_compliance/gac21/__init__.py,sha256=GTu1EyBj2T72zT3MKPettcvP-DNCJ0p6oAMj3Z-08N0,61
8
+ openadr3_client_gac_compliance-1.1.0.dist-info/LICENSE.md,sha256=NNNxKzhSK6afX-UaN8WZIVtMi5Tu8dVr6q3ciTSnH-g,10250
9
+ openadr3_client_gac_compliance-1.1.0.dist-info/METADATA,sha256=tuuieVH5mgB1rE9ijxwSyt3zSFzvB4zqEwsw98WLA-s,1096
10
+ openadr3_client_gac_compliance-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ openadr3_client_gac_compliance-1.1.0.dist-info/RECORD,,
@@ -1,4 +0,0 @@
1
- # This module imports all the GAC 3.0 compliance validators.
2
-
3
- import openadr3_client_gac_compliance.gac30.program_gac_compliant # noqa: F401
4
- import openadr3_client_gac_compliance.gac30.event_gac_compliant # noqa: F401
@@ -1,10 +0,0 @@
1
- openadr3_client_gac_compliance/__init__.py,sha256=Kla5pd6kvbbCqZdSaqlZbNfmZZe2BUWax19EHqGrHeE,254
2
- openadr3_client_gac_compliance/config.py,sha256=e8UfHlvSbNKziFN572lbxDJ8vCfh-Jv_5eDLi00lYog,675
3
- openadr3_client_gac_compliance/gac30/__init__.py,sha256=UOgLJqVCWTiiHB6rXiDFWndUlF3hZQ8IDy6qb69bPkc,220
4
- openadr3_client_gac_compliance/gac30/event_gac_compliant.py,sha256=s-pxU0lKm7MD0W0jAgKDAhnakuK1DuZhx83mtLID3zs,8157
5
- openadr3_client_gac_compliance/gac30/program_gac_compliant.py,sha256=fAmMaRumpMppvxaNonTAYTXQIWryUnuJjnsS-cCkYjE,1683
6
- openadr3_client_gac_compliance/gac31/__init__.py,sha256=GTu1EyBj2T72zT3MKPettcvP-DNCJ0p6oAMj3Z-08N0,61
7
- openadr3_client_gac_compliance-0.0.2.dist-info/LICENSE.md,sha256=NNNxKzhSK6afX-UaN8WZIVtMi5Tu8dVr6q3ciTSnH-g,10250
8
- openadr3_client_gac_compliance-0.0.2.dist-info/METADATA,sha256=EuXZG4d0TiX_Ig4ustohso02q8u61T31DhD0Yjiwp3k,1052
9
- openadr3_client_gac_compliance-0.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
10
- openadr3_client_gac_compliance-0.0.2.dist-info/RECORD,,