Skip to content

Commit

Permalink
check codestyle and mypy, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ddl-catherinetu committed Dec 8, 2022
1 parent 20aacf6 commit 8087486
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions domino_data/_feature_store/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Feature Store module."""
from typing import List, Optional, cast
from typing import Any, List, Optional, cast

import json
import os
Expand Down Expand Up @@ -104,7 +104,7 @@ def unlock(self, unlock_request: UnlockFeatureStoreRequest) -> bool:
return False if response.parsed is None else response.parsed


def _raise_response_exn(response: Response, msg: str):
def _raise_response_exn(response: Response[Any], msg: str) -> None:
try:
response_json = json.loads(response.content.decode("utf8"))
server_msg = response_json.get("errors")
Expand Down
7 changes: 4 additions & 3 deletions domino_data/_feature_store/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)

from ..logging import logger
from ..types import UNSET
from .client import FeatureStoreClient
from .exceptions import FeastRepoError, FeatureStoreLockError
from .git import pull_repo, push_to_git
Expand Down Expand Up @@ -110,7 +111,7 @@ def update_feature_views(commit_id: str, repo_path: str) -> None:
for x, y in zip(fv.entities, fv.entity_columns)
],
features=[Feature(name=f.name, dtype=str(f.dtype)) for f in fv.features],
ttl=None if fv.ttl is None else int(fv.ttl.total_seconds() * 1000),
ttl=UNSET if fv.ttl is None else int(fv.ttl.total_seconds() * 1000),
tags=FeatureViewRequestTags.from_dict(fv.tags),
)
request_input.append(feature_v)
Expand Down Expand Up @@ -174,8 +175,8 @@ def feature_store_sync(
repo_path_str: str,
branch_name: str,
max_retries: int,
skip_source_validation=False,
):
skip_source_validation: bool = False,
) -> None:
"""run feature store syncing
Args:
feature_store_id: the feature store domino id
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ color_output = true

[tool.mypy]
# mypy configurations: https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file
exclude = 'datasource_api_client/|domino_data/training_sets/|.venv/|tests/'
exclude = 'datasource_api_client/|domino_data/training_sets/|.venv/|tests/|dist/'
python_version = 3.8
pretty = true
show_traceback = true
Expand Down
6 changes: 5 additions & 1 deletion tests/feature_store/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import httpx
import pytest
from feast import FeatureStore, repo_config, repo_operations
from git import Repo
from git.repo import Repo

from domino_data._feature_store import sync
from domino_data._feature_store.exceptions import (
Expand Down Expand Up @@ -63,8 +63,12 @@ def test_sync(feast_repo_root_dir, env, respx_mock, datafx):
return_value=httpx.Response(200, content="true"),
)

repo_mock = MagicMock()
repo_mock.head.object.hexsha = "123456"

FeatureStore.__new__ = MagicMock()
Repo.__new__ = MagicMock()
Repo.__new__.return_value = repo_mock
repo_config.load_repo_config = MagicMock()
repo_operations.cli_check_repo = MagicMock()
repo_operations.apply_total = MagicMock()
Expand Down

0 comments on commit 8087486

Please sign in to comment.