diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 308bf16..0381a67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: "Set up Python" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: "Set up private packages SSH keys" uses: webfactory/ssh-agent@v0.6.0 with: @@ -56,7 +56,7 @@ jobs: - name: "Set up Python" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: "Set up private packages SSH keys" uses: webfactory/ssh-agent@v0.6.0 with: diff --git a/pyproject.toml b/pyproject.toml index a18f3e1..3360921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ [tool.black] line-length = 100 -target-version = ['py311'] +target-version = ['py312'] include = '\.pyi?$' exclude = ''' ( diff --git a/src/job/input/pubsub.py b/src/job/input/pubsub.py index 625b076..fff461c 100644 --- a/src/job/input/pubsub.py +++ b/src/job/input/pubsub.py @@ -5,6 +5,7 @@ from abc import ABC from abc import abstractmethod from typing import List +from typing import override from dialect_map_gcp import DiffMessage from dialect_map_gcp import PubSubQueueHandler @@ -66,11 +67,13 @@ def _parse_message(self, message: object) -> DiffMessage: else: return data_diff + @override def close(self) -> None: """Closes the Pub/Sub connection""" self.queue_handler.close() + @override def get_messages(self, num_messages: int) -> List[DiffMessage]: """ Retrieve parsed diff messages from a Pub/Sub subscription diff --git a/src/job/mapping/record_mapping.py b/src/job/mapping/record_mapping.py index 9dc5a0e..ee870b3 100644 --- a/src/job/mapping/record_mapping.py +++ b/src/job/mapping/record_mapping.py @@ -5,6 +5,7 @@ from abc import ABC from abc import abstractmethod from typing import List +from typing import override from dialect_map_schemas import APIRoute from dialect_map_schemas import SchemaError @@ -37,6 +38,7 @@ def __init__(self, routes: List[APIRoute]): self.routes = routes + @override def infer_route(self, record: dict) -> APIRoute: """ Infers the corresponding API route from a given data record diff --git a/src/job/output/api.py b/src/job/output/api.py index 34e77e7..dc4db79 100644 --- a/src/job/output/api.py +++ b/src/job/output/api.py @@ -4,6 +4,7 @@ from abc import ABC from abc import abstractmethod +from typing import override from dialect_map_io import DialectMapAPIHandler from dialect_map_schemas import APIRoute @@ -74,6 +75,7 @@ def _archive(self, api_path: str, record_id: str) -> None: logger.error(f"Error: {error}") raise + @override def create_record(self, record_route: APIRoute, record_data: dict) -> None: """ Performs the creation of a record on a REST API @@ -89,6 +91,7 @@ def create_record(self, record_route: APIRoute, record_data: dict) -> None: record_schema.dump(record_data), ) + @override def archive_record(self, record_route: APIRoute, record_data: dict) -> None: """ Performs the archival of a record on a REST API diff --git a/src/routines.py b/src/routines.py index da362dd..ce8e5cb 100644 --- a/src/routines.py +++ b/src/routines.py @@ -4,6 +4,7 @@ from abc import ABC from abc import abstractmethod +from typing import override from job.input import BasePubSubSource from job.mapping import BaseRecordMapper @@ -77,6 +78,7 @@ def get_mapper(self, file_name: str) -> BaseRecordMapper: logger.error(f"Invalid message source file: {file_name}") raise + @override def run(self, batch_size: int = 10) -> None: """ Main routine to move messages from a Pub/Sub topic to a REST API