diff --git a/src/ergogen_footprint_converter/converter.py b/src/ergogen_footprint_converter/converter.py index 156169e..a0586cb 100644 --- a/src/ergogen_footprint_converter/converter.py +++ b/src/ergogen_footprint_converter/converter.py @@ -1,8 +1,10 @@ -class Converter: - input = "" +from kiutils.footprint import Footprint - def __init__(self, input: str): - self.input = input +class Converter: + footprint: Footprint + + def __init__(self, footprint: Footprint): + self.footprint = footprint def convert(self) -> str: return "" diff --git a/src/ergogen_footprint_converter/main.py b/src/ergogen_footprint_converter/main.py index 8dd2418..987106e 100644 --- a/src/ergogen_footprint_converter/main.py +++ b/src/ergogen_footprint_converter/main.py @@ -3,23 +3,25 @@ from argparse import ArgumentParser from pathlib import Path -from ergogen_footprint_converter.parser import Parser -from ergogen_footprint_converter.converter import Converter +from .converter import Converter + +from kiutils.footprint import Footprint def main (args) -> None: check_args(args) - in_file: Path = args["in_file"] - out_dir: Path = args["out"] + converted = convert(args["in_file"]) - parser = Parser(in_file) - parsed = parser.parse() + write_output(converted, args["in_file"], args["out"]) + +def convert(in_file: Path) -> str: + parsed = Footprint.from_file(in_file.absolute().__str__()) converter = Converter(parsed) - converted = converter.convert() - write_output(converted, in_file, out_dir) + return converter.convert() + def write_output (output: str, in_file: Path, out_dir: Path) -> None: filename = in_file.name diff --git a/src/ergogen_footprint_converter/parser.py b/src/ergogen_footprint_converter/parser.py deleted file mode 100644 index 77b4e2d..0000000 --- a/src/ergogen_footprint_converter/parser.py +++ /dev/null @@ -1,12 +0,0 @@ -from kiutils.footprint import Footprint -from pathlib import Path - -class Parser(): - footprint: Footprint - - def __init__(self, input_file: Path): - self.footprint = Footprint.from_file(input_file.absolute().__str__()) - - def parse(self) -> str: - return "" - diff --git a/tests/unit/test_parser.py b/tests/unit/test_parser.py deleted file mode 100644 index 404b088..0000000 --- a/tests/unit/test_parser.py +++ /dev/null @@ -1,10 +0,0 @@ -from ergogen_footprint_converter.parser import Parser -import pytest -from pathlib import Path - -def test_parser_filenotexists(): - with pytest.raises(Exception, match=r".*Given path is not a file.*"): - Parser(Path("nop")) - -def test_parse(): - None