Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Introduce @override from Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinclert committed Oct 3, 2023
1 parent cfbf328 commit 635e71d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/job/input/metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging

from typing import List
from typing import override
from dialect_map_io import ArxivAPIHandler

from .base import BaseMetadataSource
Expand All @@ -25,6 +26,7 @@ def __init__(self, handler: ArxivAPIHandler, parser: FeedMetadataParser):
self.handler = handler
self.parser = parser

@override
def get_metadata(self, paper_id: str) -> List[ArxivMetadata]:
"""
Retrieves the complete metadata of the multiple ArXiv paper versions
Expand Down
2 changes: 2 additions & 0 deletions src/job/input/metadata/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging

from typing import List
from typing import override
from dialect_map_io import JSONFileHandler

from .base import BaseMetadataSource
Expand Down Expand Up @@ -36,6 +37,7 @@ def _build_metadata_file(self, file_path: str) -> dict:

return {json["id"]: json for json in self.handler.read_items(file_path)}

@override
def get_metadata(self, paper_id: str) -> List[ArxivMetadata]:
"""
Retrieves the complete metadata of the multiple ArXiv paper versions
Expand Down
2 changes: 2 additions & 0 deletions src/job/parsers/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re

from typing import List
from typing import override
from urllib import parse

from feedparser import FeedParserDict
Expand Down Expand Up @@ -82,6 +83,7 @@ def _extract_doi(self, entry: FeedParserDict) -> str:

return paper_doi

@override
def parse_body(self, feed: str) -> List[ArxivMetadata]:
"""
Parses the body section of a given feed API result
Expand Down
2 changes: 2 additions & 0 deletions src/job/parsers/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from datetime import datetime
from typing import List
from typing import override

import pytz

Expand Down Expand Up @@ -92,6 +93,7 @@ def _extract_doi(self, entry: dict) -> str:

return paper_doi

@override
def parse_body(self, entry: dict) -> List[ArxivMetadata]:
"""
Parses the metadata fields of a given metadata JSON entry
Expand Down
3 changes: 3 additions & 0 deletions src/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from abc import ABC
from abc import abstractmethod
from typing import List
from typing import override
from urllib.parse import urlparse

from dialect_map_io.handlers import TextFileHandler
Expand Down Expand Up @@ -48,6 +49,7 @@ def __init__(self, file_iter: FileSystemIterator, pdf_source: PDFCorpusSource):
self.file_iter = file_iter
self.pdf_source = pdf_source

@override
def run(self, destination_path: str) -> None:
"""
Main routine to extract ArXiv corpus text and store it locally
Expand Down Expand Up @@ -124,6 +126,7 @@ def add_sources(self, metadata_urls: List[str]) -> None:

self.sources.append(source)

@override
def run(self, *args) -> None:
"""
Main routine to extract ArXiv corpus metadata and send it to a REST API
Expand Down

0 comments on commit 635e71d

Please sign in to comment.