Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
DenizYil committed Aug 9, 2023
1 parent 7e400d8 commit 1a49041
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 9 additions & 3 deletions terracotta/handlers/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
from terracotta.profile import trace


def filter_metadata(metadata: Dict[str, Any], columns: Optional[List[str]]) -> Dict[str, Any]:
def filter_metadata(
metadata: Dict[str, Any], columns: Optional[List[str]]
) -> Dict[str, Any]:
"""Filter metadata by columns, if given"""
assert columns is None or len(columns) > 0, "columns must either be a non-empty list or None"

Expand All @@ -21,7 +23,9 @@ def filter_metadata(metadata: Dict[str, Any], columns: Optional[List[str]]) -> D


@trace("metadata_handler")
def metadata(columns: Optional[List[str]], keys: Union[Sequence[str], Mapping[str, str]]) -> Dict[str, Any]:
def metadata(
columns: Optional[List[str]], keys: Union[Sequence[str], Mapping[str, str]]
) -> Dict[str, Any]:
"""Returns all metadata for a single dataset"""
settings = get_settings()
driver = get_driver(settings.DRIVER_PATH, provider=settings.DRIVER_PROVIDER)
Expand All @@ -31,7 +35,9 @@ def metadata(columns: Optional[List[str]], keys: Union[Sequence[str], Mapping[st


@trace("multiple_metadata_handler")
def multiple_metadata(columns: Optional[List[str]], datasets: List[List[str]]) -> List[Dict[str, Any]]:
def multiple_metadata(
columns: Optional[List[str]], datasets: List[List[str]]
) -> List[Dict[str, Any]]:
"""Returns all metadata for multiple datasets"""
settings = get_settings()
driver = get_driver(settings.DRIVER_PATH, provider=settings.DRIVER_PROVIDER)
Expand Down
6 changes: 2 additions & 4 deletions terracotta/server/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ def _deserialize(self, value, attr, data, **kwargs):
if value == "[]":
return []

return value[1:-1].split(', ')
return value[1:-1].split(", ")
except ValueError:
raise ValidationError("Invalid input for a list of values.")


class MetadataColumnsSchema(Schema):
columns = CommaSeparatedListField(
description="Columns of dataset to be returned"
)
columns = CommaSeparatedListField(description="Columns of dataset to be returned")


class MultipleMetadataDatasetsSchema(Schema):
Expand Down

0 comments on commit 1a49041

Please sign in to comment.