Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
python-version: ["3.10"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ develop, master ]
branches: [develop, master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches: [develop]
schedule:
- cron: '20 18 * * 4'
- cron: "20 18 * * 4"

jobs:
analyze:
Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
python-version: ["3.10"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: "Linting"
on: [ push ]
on: [push]
jobs:
linting:
name: Python Code Quality and Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.8 ]
os: [ ubuntu-latest ]
python-version: ["3.10"]
os: [ubuntu-latest]
linter-env: ["linting", "type_check"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -18,6 +19,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install tox
- name: Linting bo4e
- name: Run ${{ matrix.linter-env }}
run: |
tox -e linting
tox -e ${{ matrix.linter-env }}
6 changes: 3 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ name: Upload Python Package
on:
release:
branches: master
types: [ created, edited ]
types: [created, edited]

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.8 ]
os: [ ubuntu-latest ]
python-version: [3.8]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Tests

on: [ push ]
on: [push]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.8 ]
os: [ ubuntu-latest ]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import shutil
import sys


__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ markers = ["datafiles: load datafiles"]
max-line-length = 120

[tool.isort]
line_length = 120
line_length = 120
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ install_requires =
where = src
exclude =
tests

[options.package_data]
* = py.typed
8 changes: 5 additions & 3 deletions src/bo4e/bo/ansprechpartner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
"""
import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from bo4e.com.rufnummer import Rufnummer, RufnummerSchema
from bo4e.com.adresse import Adresse, AdresseSchema
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.bo.geschaeftspartner import Geschaeftspartner, GeschaeftspartnerSchema
from bo4e.com.adresse import Adresse, AdresseSchema
from bo4e.com.rufnummer import Rufnummer, RufnummerSchema
from bo4e.com.zustaendigkeit import Zustaendigkeit, ZustaendigkeitSchema
from bo4e.enum.anrede import Anrede
from bo4e.enum.botyp import BoTyp
from bo4e.enum.titel import Titel


# pylint: disable=too-many-instance-attributes, too-few-public-methods
@attr.s(auto_attribs=True, kw_only=True)
class Ansprechpartner(Geschaeftsobjekt):
Expand Down
18 changes: 14 additions & 4 deletions src/bo4e/bo/geschaeftsobjekt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@
and corresponding marshmallow schema for de-/serialization
"""
# pylint: disable=unused-argument, too-few-public-methods
from typing import List, Optional
from typing import List, Optional, Type

import attr
from marshmallow import fields, post_load
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.com.externereferenz import ExterneReferenz, ExterneReferenzSchema
from bo4e.enum.botyp import BoTyp
from bo4e.schemata.caseconverterschema import CaseConverterSchema


def _create_empty_referenzen_list() -> List[ExterneReferenz]:
"""
A method with a type hint to please mypy
https://stackoverflow.com/a/61281305/10009545
:return:
"""
return []


@attr.s(auto_attribs=True, kw_only=True)
class Geschaeftsobjekt:
"""
Expand All @@ -25,7 +35,7 @@ class Geschaeftsobjekt:

# optional attributes
externe_referenzen: Optional[List[ExterneReferenz]] = attr.ib(
default=[], validator=attr.validators.instance_of(List)
default=_create_empty_referenzen_list(), validator=attr.validators.instance_of(List) # type:ignore[arg-type]
)


Expand All @@ -36,7 +46,7 @@ class GeschaeftsobjektSchema(CaseConverterSchema):
"""

# class_name is needed to use the correct schema for deserialization.
class_name = Geschaeftsobjekt
class_name: Type[Geschaeftsobjekt] = Geschaeftsobjekt

# required attributes
versionstruktur = fields.String()
Expand Down
23 changes: 12 additions & 11 deletions src/bo4e/bo/geschaeftspartner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
and corresponding marshmallow schema for de-/serialization
"""
# pylint: disable=too-many-instance-attributes, too-few-public-methods
from typing import List
from typing import List, Optional, Type

import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.com.adresse import Adresse, AdresseSchema
from bo4e.enum.anrede import Anrede
Expand All @@ -30,15 +31,15 @@ class Geschaeftspartner(Geschaeftsobjekt):

# optional attributes
anrede: Anrede = attr.ib(default=None)
name2: str = attr.ib(default=None)
name3: str = attr.ib(default=None)
hrnummer: str = attr.ib(default=None)
amtsgericht: str = attr.ib(default=None)
name2: Optional[str] = attr.ib(default=None)
name3: Optional[str] = attr.ib(default=None)
hrnummer: Optional[str] = attr.ib(default=None)
amtsgericht: Optional[str] = attr.ib(default=None)
kontaktweg: List[Kontaktart] = attr.ib(default=[])
umsatzsteuer_id: str = attr.ib(default=None)
glaeubiger_id: str = attr.ib(default=None)
e_mail_adresse: str = attr.ib(default=None)
website: str = attr.ib(default=None)
umsatzsteuer_id: Optional[str] = attr.ib(default=None)
glaeubiger_id: Optional[str] = attr.ib(default=None)
e_mail_adresse: Optional[str] = attr.ib(default=None)
website: Optional[str] = attr.ib(default=None)
partneradresse: Adresse = attr.ib(default=None)


Expand All @@ -49,7 +50,7 @@ class GeschaeftspartnerSchema(GeschaeftsobjektSchema):

# class_name is needed to use the correct schema for deserialisation.
# see function `deserialize` in geschaeftsobjekt.py
class_name = Geschaeftspartner
class_name: Type[Geschaeftspartner] = Geschaeftspartner

# required attributes
name1 = fields.Str()
Expand Down
4 changes: 2 additions & 2 deletions src/bo4e/bo/marktlokation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.bo.geschaeftspartner import Geschaeftspartner, GeschaeftspartnerSchema
from bo4e.com.adresse import Adresse, AdresseSchema
Expand All @@ -22,7 +23,6 @@
from bo4e.enum.sparte import Sparte
from bo4e.enum.verbrauchsart import Verbrauchsart


_malo_id_pattern = re.compile(r"^[1-9][\d]{10}$")


Expand Down
5 changes: 3 additions & 2 deletions src/bo4e/bo/marktteilnehmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
and corresponding marshmallow schema for de-/serialization
"""
import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from attr.validators import matches_re
from marshmallow import fields
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftspartner import Geschaeftspartner, GeschaeftspartnerSchema
from bo4e.enum.botyp import BoTyp
from bo4e.enum.marktrolle import Marktrolle
Expand Down
4 changes: 2 additions & 2 deletions src/bo4e/bo/messlokation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from typing import List, Optional

import attr
from iso3166 import countries
from iso3166 import countries # type:ignore[import]
from marshmallow import fields
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.bo.zaehler import Zaehler, ZaehlerSchema
Expand Down
10 changes: 6 additions & 4 deletions src/bo4e/bo/vertrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
"""
from datetime import datetime
from typing import List, Optional

import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.bo.geschaeftspartner import Geschaeftspartner, GeschaeftspartnerSchema
from bo4e.com.vertragsteil import Vertragsteil, VertragsteilSchema
from bo4e.com.vertragskonditionen import Vertragskonditionen, VertragskonditionenSchema
from bo4e.com.unterschrift import Unterschrift, UnterschriftSchema
from bo4e.com.vertragskonditionen import Vertragskonditionen, VertragskonditionenSchema
from bo4e.com.vertragsteil import Vertragsteil, VertragsteilSchema
from bo4e.enum.botyp import BoTyp
from bo4e.enum.sparte import Sparte
from bo4e.enum.vertragsart import Vertragsart
from bo4e.enum.vertragsstatus import Vertragsstatus
from bo4e.enum.sparte import Sparte


# pylint: disable=unused-argument
def at_least_one_vertragsteil(instance, attribute, value):
Expand Down
3 changes: 2 additions & 1 deletion src/bo4e/bo/zaehler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import attr
from marshmallow import fields
from marshmallow_enum import EnumField
from marshmallow_enum import EnumField # type:ignore[import]

from bo4e.bo.geschaeftsobjekt import Geschaeftsobjekt, GeschaeftsobjektSchema
from bo4e.bo.geschaeftspartner import Geschaeftspartner, GeschaeftspartnerSchema
Expand All @@ -19,6 +19,7 @@
from bo4e.enum.zaehlerauspraegung import Zaehlerauspraegung
from bo4e.enum.zaehlertyp import Zaehlertyp


# pylint: disable=unused-argument
def at_least_one_zaehlwerk(instance, attribute, value):
"""
Expand Down
Loading