Skip to content

Commit 169d473

Browse files
authored
Merge pull request #20 from Hochfrequenz/develop
Fix Landescode and typo in Markteilnehmer class
2 parents 0e43c15 + dac922a commit 169d473

25 files changed

Lines changed: 257 additions & 112 deletions

docs/api/bo4e.com.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ bo4e.com.com module
2020
:undoc-members:
2121
:show-inheritance:
2222

23+
bo4e.com.externereferenz module
24+
-------------------------------
25+
26+
.. automodule:: bo4e.com.externereferenz
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
2331
bo4e.com.geokoordinaten module
2432
------------------------------
2533

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
# pip-compile requirements/base.in
66
#
77
attrs==20.3.0 # via -r requirements/base.in
8+
iso3166==1.0.1 # via -r requirements/base.in
89
jsons==1.3.0 # via -r requirements/base.in
910
typish==1.9.1 # via jsons

requirements/dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ flake8==3.8.4 # via -r requirements/dev.in, -r requirements\tests.in
2121
idna==2.10 # via requests
2222
imagesize==1.2.0 # via sphinx
2323
iniconfig==1.1.1 # via pytest
24+
iso3166==1.0.1 # via -r requirements\base.in
2425
jinja2==2.11.2 # via sphinx
2526
jsons==1.3.0 # via -r requirements\base.in
2627
markupsafe==1.1.1 # via jinja2

requirements/docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ colorama==0.4.4 # via sphinx
1313
docutils==0.16 # via sphinx
1414
idna==2.10 # via requests
1515
imagesize==1.2.0 # via sphinx
16+
iso3166==1.0.1 # via -r requirements\base.in
1617
jinja2==2.11.2 # via sphinx
1718
jsons==1.3.0 # via -r requirements\base.in
1819
markupsafe==1.1.1 # via jinja2

requirements/tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ attrs==20.2.0 # via -r requirements\base.in, pytest
99
colorama==0.4.4 # via pytest
1010
flake8==3.8.4 # via -r requirements/tests.in
1111
iniconfig==1.1.1 # via pytest
12+
iso3166==1.0.1 # via -r requirements\base.in
1213
jsons==1.3.0 # via -r requirements\base.in
1314
mccabe==0.6.1 # via flake8
1415
packaging==20.4 # via pytest

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project-urls =
88
license = mit
99
author = Kevin Krechan
1010
author-email = kevin.krechan@hochfrequenz.de
11-
description = Python Library that Implements the BO4E Standard.
11+
description = Python Library that implements the BO4E Standard.
1212
long-description = file: README.rst
1313
long-description-content-type = text/x-rst; charset=UTF-8
1414
platforms = any

src/bo4e/bo/geschaeftsobjekt.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
from typing import List, Optional
2+
13
import attr
4+
import jsons
25

6+
from bo4e.com.externereferenz import ExterneReferenz
37
from bo4e.enum.botyp import BoTyp
48

59

610
@attr.s(auto_attribs=True, kw_only=True)
7-
class Geschaeftsobjekt:
11+
class Geschaeftsobjekt(jsons.JsonSerializable):
812
"""
913
base class for all business objects
1014
"""
1115

12-
bo_typ: BoTyp
1316
versionstruktur: int = attr.ib(default=2)
17+
bo_typ: BoTyp
18+
externe_referenzen: Optional[List[ExterneReferenz]] = attr.ib(
19+
default=None, validator=attr.validators.instance_of((type(None), List))
20+
)

src/bo4e/bo/geschaeftspartner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from bo4e.enum.botyp import BoTyp
1010

1111

12-
@attr.s(auto_attribs=True, kw_only=True, frozen=True)
12+
@attr.s(auto_attribs=True, kw_only=True)
1313
class Geschaeftspartner(Geschaeftsobjekt, jsons.JsonSerializable):
1414
"""
1515
Objekt zur Aufnahme der Information zu einem Geschaeftspartner

src/bo4e/bo/marktlokation.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
_malo_id_pattern = re.compile(r"^[1-9][\d]{10}$")
2121

2222

23-
@attr.s(auto_attribs=True, kw_only=True, frozen=True)
23+
@attr.s(auto_attribs=True, kw_only=True)
2424
class Marktlokation(Geschaeftsobjekt, jsons.JsonSerializable):
2525
"""
2626
Objekt zur Aufnahme der Informationen zu einer Marktlokation
@@ -30,12 +30,15 @@ def _validate_marktlokations_id(self, marklokations_id_attribute, value):
3030
if not value:
3131
raise ValueError("The marktlokations_id must not be empty.")
3232
if not _malo_id_pattern.match(value):
33-
raise ValueError(f"The marktlokations_id '{value}' does not match {_malo_id_pattern.pattern}")
33+
raise ValueError(
34+
f"The marktlokations_id '{value}' does not match {_malo_id_pattern.pattern}"
35+
)
3436
expected_checksum = Marktlokation._get_checksum(value)
3537
actual_checksum = value[10:11]
3638
if expected_checksum != actual_checksum:
3739
raise ValueError(
38-
f"The marktlokations_id '{value}' has checksum '{actual_checksum}' but '{expected_checksum}' was expected.")
40+
f"The marktlokations_id '{value}' has checksum '{actual_checksum}' but '{expected_checksum}' was expected."
41+
)
3942

4043
marktlokations_id: str = attr.ib(validator=_validate_marktlokations_id)
4144
sparte: Sparte
@@ -92,7 +95,7 @@ def _get_checksum(malo_id: str) -> str:
9295
# start counting at 1 to be consistent with the above description
9396
# of "even" and "odd" but stop at tenth digit.
9497
for i in range(1, 11):
95-
s = malo_id[i - 1:i]
98+
s = malo_id[i - 1 : i]
9699
if i % 2 == 0:
97100
even_checksum += 2 * int(s)
98101
else:

src/bo4e/bo/marktteilnehmer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from bo4e.enum.rollencodetyp import Rollencodetyp
99

1010

11-
@attr.s(auto_attribs=True, kw_only=True, frozen=True)
12-
class Marktteilehmer(Geschaeftspartner, jsons.JsonSerializable):
11+
@attr.s(auto_attribs=True, kw_only=True)
12+
class Marktteilnehmer(Geschaeftspartner, jsons.JsonSerializable):
1313
"""
1414
Objekt zur Aufnahme der Information zu einem Marktteilnehmer
1515
"""

0 commit comments

Comments
 (0)