diff --git a/dev_requirements/requirements-formatting.txt b/dev_requirements/requirements-formatting.txt index 00cc795d..718f254d 100644 --- a/dev_requirements/requirements-formatting.txt +++ b/dev_requirements/requirements-formatting.txt @@ -4,7 +4,7 @@ # # pip-compile requirements-formatting.in # -black==23.12.1 +black==24.1.1 # via -r dev_requirements/requirements-formatting.in click==8.1.7 # via black diff --git a/src/maus/cli.py b/src/maus/cli.py index 762b0b14..45166a91 100644 --- a/src/maus/cli.py +++ b/src/maus/cli.py @@ -1,6 +1,7 @@ """ the maus cli tool """ + import json from pathlib import Path diff --git a/src/maus/division_helper.py b/src/maus/division_helper.py index 9256619e..80b2a350 100644 --- a/src/maus/division_helper.py +++ b/src/maus/division_helper.py @@ -1,6 +1,7 @@ """ division helper is a module that allow to distinguish electricity ("Strom") and gas ("Gas") """ + from enum import Enum from typing import Optional diff --git a/src/maus/edifact.py b/src/maus/edifact.py index bd7d53ac..8979ee00 100644 --- a/src/maus/edifact.py +++ b/src/maus/edifact.py @@ -1,6 +1,7 @@ """ This module manages EDIFACT related stuff. It's basically a helper module to avoid stringly typed parameters. """ + import datetime import re from enum import Enum diff --git a/src/maus/mig_ahb_matching.py b/src/maus/mig_ahb_matching.py index 9b49cc4a..cb3da222 100644 --- a/src/maus/mig_ahb_matching.py +++ b/src/maus/mig_ahb_matching.py @@ -2,6 +2,7 @@ MAUS is the MIG AHB Utility stack. This module contains methods to merge data from Message Implementation Guide and Anwendungshandbuch """ + from itertools import groupby from typing import List, Optional, Sequence, Set, Tuple diff --git a/src/maus/navigation.py b/src/maus/navigation.py index 907a8252..a8a0139e 100644 --- a/src/maus/navigation.py +++ b/src/maus/navigation.py @@ -3,6 +3,7 @@ I.e. it allows to loop over an Anwendungshandbuch and "remember" which turns we took in the MIG structure (each turn is a AhbLocationLayer) in order to arrive at a certain line of the AHB. This information is stored in an AhbLocation. """ + import sys from enum import Enum from typing import Callable, List, Optional, Tuple, TypeVar, Union, overload @@ -249,27 +250,23 @@ class _PseudoAhbLocation(AhbLocation): @overload -def find_common_ancestor(location_x: _PseudoAhbLocation, location_y: _PseudoAhbLocation) -> _PseudoAhbLocation: - ... +def find_common_ancestor(location_x: _PseudoAhbLocation, location_y: _PseudoAhbLocation) -> _PseudoAhbLocation: ... @overload def find_common_ancestor( location_x: _PseudoAhbLocation, location_y: Union[AhbLocation, _PseudoAhbLocation] -) -> _PseudoAhbLocation: - ... +) -> _PseudoAhbLocation: ... @overload def find_common_ancestor( location_x: Union[AhbLocation, _PseudoAhbLocation], location_y: _PseudoAhbLocation -) -> _PseudoAhbLocation: - ... +) -> _PseudoAhbLocation: ... @overload -def find_common_ancestor(location_x: AhbLocation, location_y: AhbLocation) -> AhbLocation: - ... +def find_common_ancestor(location_x: AhbLocation, location_y: AhbLocation) -> AhbLocation: ... def find_common_ancestor( diff --git a/src/maus/reader/ahb_location_xml.py b/src/maus/reader/ahb_location_xml.py index 4ada9622..9852ef20 100644 --- a/src/maus/reader/ahb_location_xml.py +++ b/src/maus/reader/ahb_location_xml.py @@ -1,6 +1,7 @@ """ module that (de)serializes AhbLocations to/from XML """ + from typing import List, Union import attrs diff --git a/src/maus/reader/etree_element_helpers.py b/src/maus/reader/etree_element_helpers.py index d6348f53..de5f7f53 100644 --- a/src/maus/reader/etree_element_helpers.py +++ b/src/maus/reader/etree_element_helpers.py @@ -2,6 +2,7 @@ This module contains (static) functions that process single lxml.etree Elements. Each function is separately unit tested. """ + import re from typing import List, Literal, Optional diff --git a/src/maus/reader/flat_ahb_reader.py b/src/maus/reader/flat_ahb_reader.py index cd939fa3..5817b4da 100644 --- a/src/maus/reader/flat_ahb_reader.py +++ b/src/maus/reader/flat_ahb_reader.py @@ -1,6 +1,7 @@ """ A module that reads AHBs from a given CSV file """ + import csv import logging import re @@ -273,13 +274,11 @@ def to_flat_ahb(self) -> FlatAnwendungshandbuch: @overload -def _replace_hardcoded_section_names(section_name: str) -> str: - ... +def _replace_hardcoded_section_names(section_name: str) -> str: ... @overload -def _replace_hardcoded_section_names(section_name: Literal[None]) -> Literal[None]: - ... +def _replace_hardcoded_section_names(section_name: Literal[None]) -> Literal[None]: ... def _replace_hardcoded_section_names(section_name: Optional[str]) -> Optional[str]: diff --git a/src/maus/reader/mig_ahb_name_helpers.py b/src/maus/reader/mig_ahb_name_helpers.py index de1e08b4..b312de5a 100644 --- a/src/maus/reader/mig_ahb_name_helpers.py +++ b/src/maus/reader/mig_ahb_name_helpers.py @@ -1,19 +1,18 @@ """ This module contains helper methods that compare strings, especially names from AHB and MIG. """ + from typing import Literal, Optional, overload from lxml import etree # type:ignore[import] @overload -def make_name_comparable(orig_str: str) -> str: - ... +def make_name_comparable(orig_str: str) -> str: ... @overload -def make_name_comparable(orig_str: Literal[None]) -> Literal[None]: - ... +def make_name_comparable(orig_str: Literal[None]) -> Literal[None]: ... def make_name_comparable(orig_str: Optional[str]) -> Optional[str]: diff --git a/src/maus/reader/mig_reader.py b/src/maus/reader/mig_reader.py index fac99626..262c872d 100644 --- a/src/maus/reader/mig_reader.py +++ b/src/maus/reader/mig_reader.py @@ -1,6 +1,7 @@ """ Classes that allow to read XML files that contain structural information (Message Implementation Guide information) """ + from abc import ABC, abstractmethod from maus.models.edifact_components import EdifactStack diff --git a/src/maus/reader/mig_xml_reader.py b/src/maus/reader/mig_xml_reader.py index a6434d3b..8d1e3455 100644 --- a/src/maus/reader/mig_xml_reader.py +++ b/src/maus/reader/mig_xml_reader.py @@ -1,6 +1,7 @@ """ contains the MigXmlReader - a MIG Reader that is based on XML MIGs (and therefore requires lxml) """ + import re from pathlib import Path from typing import List, Set, TypeVar, Union diff --git a/src/maus/reader/tree_to_sgh.py b/src/maus/reader/tree_to_sgh.py index 30f290db..bfc6e876 100644 --- a/src/maus/reader/tree_to_sgh.py +++ b/src/maus/reader/tree_to_sgh.py @@ -1,6 +1,7 @@ """ A module to parse Hochfrequenz .tree files and return them as Segment Group Hierarchy """ + from pathlib import Path from typing import Union diff --git a/src/maus/transformation.py b/src/maus/transformation.py index e380adb8..33832cd5 100644 --- a/src/maus/transformation.py +++ b/src/maus/transformation.py @@ -21,6 +21,7 @@ This module contains methods that are relevant when transforming data between your edi-similar structure ("EdiSeed") and the application domain ("non-edifact"). """ + import asyncio from typing import Any, Awaitable, Dict, List, Mapping, Optional, Protocol, TypeVar diff --git a/tests/unit_tests/example_data_11042.py b/tests/unit_tests/example_data_11042.py index 59c0b54e..1cd3e133 100644 --- a/tests/unit_tests/example_data_11042.py +++ b/tests/unit_tests/example_data_11042.py @@ -1,6 +1,7 @@ """ example AHB data for 11042 as of 2021-10-01 """ + from uuid import UUID from maus.models.anwendungshandbuch import AhbLine, AhbMetaInformation, FlatAnwendungshandbuch diff --git a/tests/unit_tests/test_maus_provider.py b/tests/unit_tests/test_maus_provider.py index a867a850..b3791d93 100644 --- a/tests/unit_tests/test_maus_provider.py +++ b/tests/unit_tests/test_maus_provider.py @@ -1,6 +1,7 @@ """ Test the maus provider as a concept and the file based maus provider as an implementation. """ + import json from pathlib import Path