Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
noctillion committed Oct 12, 2023
1 parent 61b844d commit 7e10aeb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions chord_metadata_service/chord/views_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
experiment__dataset_id=dataset_id),
}

async def _filtered_query(data_type: str, project: Optional[str] = None, dataset: Optional[str] = None) -> Optional[QuerySet]:

async def _filtered_query(data_type: str, project: Optional[str] = None,
dataset: Optional[str] = None) -> Optional[QuerySet]:
"""
Returns a filtered query based on the data type, project, and dataset.
"""
Expand Down Expand Up @@ -70,15 +72,20 @@ async def _filtered_query(data_type: str, project: Optional[str] = None, dataset

return q

async def get_count_for_data_type(data_type: str, project: Optional[str] = None, dataset: Optional[str] = None) -> Optional[int]:

async def get_count_for_data_type(data_type: str, project: Optional[str] = None,
dataset: Optional[str] = None) -> Optional[int]:
"""
Returns the count for a particular data type. If dataset is provided, project will be ignored. If neither are
provided, the count will be for the whole node.
"""
q = await _filtered_query(data_type, project, dataset)
return None if q is None else await q.acount()

async def get_last_ingested_for_data_type(data_type: str, project: Optional[str] = None, dataset: Optional[str] = None) -> Optional[dict]:

async def get_last_ingested_for_data_type(data_type: str, project: Optional[str] = None,
dataset: Optional[str] = None) -> Optional[dict]:

q = await _filtered_query(data_type, project, dataset)
if q is None:
return None
Expand All @@ -89,6 +96,7 @@ async def get_last_ingested_for_data_type(data_type: str, project: Optional[str]

return latest_obj.created


async def make_data_type_response_object(
data_type_id: str,
data_type_details: dict,
Expand Down

0 comments on commit 7e10aeb

Please sign in to comment.