Skip to content

Commit

Permalink
Mypy typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejzj committed Nov 13, 2023
1 parent 90b6c44 commit 9553ca7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
4 changes: 1 addition & 3 deletions it_jobs_meta/common/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def args(self) -> dict[str, Any]:
self._args = vars(self._parser.parse_args())
return self._args

def extract_data_lake(self) -> tuple[DataLakeImpl, Path] | None:
def extract_data_lake(self) -> tuple[DataLakeImpl, Path]:
"""Extract data lake setup from the arguments.
:return: Tuple with the selected data lake implementation type and
Expand All @@ -61,8 +61,6 @@ def extract_data_lake(self) -> tuple[DataLakeImpl, Path] | None:
return DataLakeImpl.REDIS, self.args['redis']
case {'s3_bucket': Path(), 'redis': None}:
return DataLakeImpl.S3BUCKET, self.args['s3_bucket']
case {'s3_bucket': None, 'redis': None}:
return None
case _:
raise ValueError(
'Parsed arguments resulted in unsupported or invalid data'
Expand Down
2 changes: 1 addition & 1 deletion it_jobs_meta/dashboard/data_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
db_name: str,
port=27017,
):
self._db_client = pymongo.MongoClient(
self._db_client: pymongo.MongoClient = pymongo.MongoClient(
f'mongodb://{user_name}:{password}@{host}:{port}'
)
self._db = self._db_client[db_name]
Expand Down
2 changes: 1 addition & 1 deletion it_jobs_meta/data_pipeline/data_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def __init__(
db_name: str,
port=27017,
):
self._db_client = pymongo.MongoClient(
self._db_client: pymongo.MongoClient = pymongo.MongoClient(
f'mongodb://{user_name}:{password}@{host}:{port}'
)
self._db = self._db_client[db_name]
Expand Down
2 changes: 1 addition & 1 deletion it_jobs_meta/data_pipeline/data_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get(self) -> PostingsData:
return data


class ArchiveNoFluffJObsPostingsDataSource:
class ArchiveNoFluffJObsPostingsDataSource(PostingsDataSource):
"""Load postings data from archive under URL (from data lake or file)"""

def __init__(self, posting_url: str):
Expand Down
4 changes: 2 additions & 2 deletions it_jobs_meta/data_pipeline/data_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class Schemas:
'id': pa.Column(str),
'city': pa.Column(str),
'lat': pa.Column(
float, pa.Check.ge(-90), pa.Check.le(90), coerce=True
float, pa.Check.ge(-90), pa.Check.le(90), coerce=True # type: ignore # noqa: e510
),
'lon': pa.Column(
float, pa.Check.ge(-180), pa.Check.le(180), coerce=True
float, pa.Check.ge(-180), pa.Check.le(180), coerce=True # type: ignore # noqa: e501
),
}
)
Expand Down
3 changes: 2 additions & 1 deletion it_jobs_meta/data_pipeline/geolocator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Geolocation services."""

import functools
from typing import Sequence

from geopy.geocoders import Nominatim


class Geolocator:
def __init__(self, country_filter: tuple[str, ...] | None = None):
def __init__(self, country_filter: Sequence[str] | None = None):
"""Create geolocator instance.
:param country_filter: Tuple of country names that the geolocation
Expand Down

0 comments on commit 9553ca7

Please sign in to comment.