Skip to content

Commit

Permalink
Ignore type checking for stubbed functions
Browse files Browse the repository at this point in the history
Signed-off-by: Kristen Armes <[email protected]>
  • Loading branch information
kristenarmes committed Apr 4, 2024
1 parent 0315bcb commit 6cd85e5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
4 changes: 3 additions & 1 deletion metadata/metadata_service/api/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import logging
from http import HTTPStatus
from typing import Any, Iterable, Mapping, Union
from typing import Any, Iterable, Mapping, Union, no_type_check

from amundsen_common.entity.resource_type import ResourceType
from amundsen_common.models.feature import FeatureSchema
Expand Down Expand Up @@ -78,6 +78,7 @@ class FeatureStatsAPI(Resource):
def __init__(self) -> None:
self.client = get_proxy_client()

@no_type_check
@swag_from('swagger_doc/feature/detail_get.yml')
def get(self, feature_uri: str) -> Iterable[Union[Mapping, int, None]]:
pass
Expand Down Expand Up @@ -111,6 +112,7 @@ class FeatureSampleAPI(Resource):
def __init__(self) -> None:
self.client = get_proxy_client()

@no_type_check
@swag_from('swagger_doc/feature/detail_get.yml')
def get(self, feature_uri: str) -> Iterable[Union[Mapping, int, None]]:
pass
Expand Down
8 changes: 7 additions & 1 deletion metadata/metadata_service/proxy/atlas_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from operator import attrgetter
from random import randint
from typing import (Any, Dict, Generator, List, Optional, Set, Tuple, Type,
Union)
Union, no_type_check)

from amundsen_common.entity.resource_type import ResourceType
from amundsen_common.models.dashboard import DashboardSummary
Expand Down Expand Up @@ -394,9 +394,11 @@ def _get_owners(self, data_owners: list, fallback_owner: Optional[str] = None) -
def get_user(self, *, id: str) -> Union[UserEntity, None]:
pass

@no_type_check
def create_update_user(self, *, user: User) -> Tuple[User, bool]:
pass

@no_type_check
def get_users(self) -> List[UserEntity]:
pass

Expand Down Expand Up @@ -843,6 +845,7 @@ def get_latest_updated_ts(self) -> int:

return date or 0

@no_type_check
def get_statistics(self) -> Dict[str, Any]:
# Not implemented
pass
Expand Down Expand Up @@ -1675,9 +1678,11 @@ def get_lineage(self, *, id: str, resource_type: ResourceType, direction: str, d

return lineage

@no_type_check
def get_feature(self, *, feature_uri: str) -> Feature:
pass

@no_type_check
def get_resource_description(self, *,
resource_type: ResourceType,
uri: str) -> Description:
Expand All @@ -1701,6 +1706,7 @@ def delete_resource_owner(self, *,
owner: str) -> None:
pass

@no_type_check
def get_resource_generation_code(self, *,
uri: str,
resource_type: ResourceType) -> GenerationCode:
Expand Down
9 changes: 9 additions & 0 deletions metadata/metadata_service/proxy/gremlin_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ def _get_user(self, *, id: str, executor: ExecuteQuery) -> Union[User, None]:
user.manager_fullname = _safe_get(managers[0], 'full_name', default=None) if managers else None
return user

@no_type_check
def create_update_user(self, *, user: User) -> Tuple[User, bool]:
pass

Expand Down Expand Up @@ -1471,6 +1472,7 @@ def get_latest_updated_ts(self) -> int:
key=AMUNDSEN_TIMESTAMP_KEY).values('latest_timestamp').toList()
return _safe_get(results, transform=int)

@no_type_check
def get_statistics(self) -> Dict[str, Any]:
# Not implemented
pass
Expand All @@ -1490,6 +1492,7 @@ def get_tags(self) -> List:
counts = self.query_executor()(query=g, get=FromResultSet.getOnly)
return [TagDetail(tag_name=name, tag_count=value) for name, value in counts.items()]

@no_type_check
def get_badges(self) -> List:
pass

Expand Down Expand Up @@ -1553,13 +1556,15 @@ def get_table_by_user_relation(self, *, user_email: str, relation_type: UserReso
# this is weird but the convention
return {'table': popular_tables}

@no_type_check
@timer_with_counter
@overrides
def get_dashboard_by_user_relation(self, *, user_email: str, relation_type: UserResourceRel) \
-> Dict[str, List[DashboardSummary]]:
pass

# TODO: impl
@no_type_check
@timer_with_counter
@overrides
def get_frequently_used_tables(self, *, user_email: str) -> Dict[str, Any]:
Expand Down Expand Up @@ -1816,6 +1821,7 @@ def get_dashboard(self,
tables=tables
)

@no_type_check
@timer_with_counter
@overrides
def get_dashboard_description(self, *,
Expand Down Expand Up @@ -2074,9 +2080,11 @@ def get_lineage(self, *,
return Lineage(key=id, upstream_entities=upstream_tables, downstream_entities=downstream_tables,
direction=direction, depth=depth)

@no_type_check
def get_feature(self, *, feature_uri: str) -> Feature:
pass

@no_type_check
def get_resource_description(self, *,
resource_type: ResourceType,
uri: str) -> Description:
Expand All @@ -2100,6 +2108,7 @@ def delete_resource_owner(self, *,
owner: str) -> None:
pass

@no_type_check
def get_resource_generation_code(self, *,
uri: str,
resource_type: ResourceType) -> GenerationCode:
Expand Down
6 changes: 5 additions & 1 deletion metadata/metadata_service/proxy/mysql_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from collections import namedtuple
from random import randint
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union, no_type_check

from amundsen_common.entity.resource_type import ResourceType, to_resource_type
from amundsen_common.models.dashboard import DashboardSummary
Expand Down Expand Up @@ -1605,12 +1605,15 @@ def get_next_edge(node: str) -> Iterator[Edge]:
lineage_item_sorted.reverse()
return lineage_item_sorted

@no_type_check
def get_statistics(self) -> Dict[str, Any]:
pass

@no_type_check
def get_feature(self, *, feature_uri: str) -> Feature:
pass

@no_type_check
def get_resource_description(self, *, resource_type: ResourceType, uri: str) -> Description:
pass

Expand All @@ -1623,6 +1626,7 @@ def add_resource_owner(self, *, uri: str, resource_type: ResourceType, owner: st
def delete_resource_owner(self, *, uri: str, resource_type: ResourceType, owner: str) -> None:
pass

@no_type_check
def get_resource_generation_code(self, *, uri: str, resource_type: ResourceType) -> GenerationCode:
pass

Expand Down
20 changes: 10 additions & 10 deletions metadata/tests/unit/proxy/fixtures/atlas_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class Data:
{'attributes': {
'stat_name': 'max',
'stat_val': 100.1234,
'start_epoch': 100,
'end_epoch': 200,
'start_epoch': '100',
'end_epoch': '200',
}},
{'attributes': {
'stat_name': 'min',
'stat_val': 0.5678,
'start_epoch': 100,
'end_epoch': 200,
'start_epoch': '100',
'end_epoch': '200',
}},
]
},
Expand All @@ -74,23 +74,23 @@ class Data:
{'attributes': {
'stat_name': 'max',
'stat_val': '100.1234',
'start_epoch': 100,
'end_epoch': 200,
'start_epoch': '100',
'end_epoch': '200',
}},
{'attributes': {
'stat_name': 'min',
'stat_val': '0.5678',
'start_epoch': 100,
'end_epoch': 200,
'start_epoch': '100',
'end_epoch': '200',
}},
]

test_exp_col_stats_formatted = [
{'attributes': {
'stat_name': 'minimum',
'stat_val': '0.57',
'start_epoch': 100,
'end_epoch': 200,
'start_epoch': '100',
'end_epoch': '200',
}},
]

Expand Down
4 changes: 2 additions & 2 deletions metadata/tests/unit/proxy/test_atlas_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def _get_table(self, custom_stats_format: bool = False) -> None:
Stat(
stat_type=stats['attributes']['stat_name'],
stat_val=stats['attributes']['stat_val'],
start_epoch=int(stats['attributes']['start_epoch']),
end_epoch=int(stats['attributes']['end_epoch']),
start_epoch=stats['attributes']['start_epoch'],
end_epoch=stats['attributes']['end_epoch'],
)
)

Expand Down

0 comments on commit 6cd85e5

Please sign in to comment.