Skip to content

Commit

Permalink
DatasetInstance -> DatasetProtocol in larch.py typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Nov 24, 2023
1 parent 42a2219 commit cfab9e8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/galaxy/datatypes/larch.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
from typing import List, TYPE_CHECKING
from typing import List

from galaxy.datatypes.data import (
get_file_peek,
Text,
)
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
get_headers,
)

if TYPE_CHECKING:
from galaxy.model import DatasetInstance


@build_sniff_from_prefix
class AthenaProject(Text):
Expand Down Expand Up @@ -78,7 +76,7 @@ def sniff_prefix(self, file_prefix: FilePrefix) -> bool:

return file_prefix.startswith("# Athena project file")

def set_meta(self, dataset: "DatasetInstance", overwrite: bool = True, **kwd) -> None:
def set_meta(self, dataset: DatasetProtocol, *, overwrite: bool = True, **kwd) -> None:
"""
Extract metadata from @args
"""
Expand All @@ -104,7 +102,7 @@ def extract_arg(args: List[str], arg_name: str):
extract_arg(args, "xmax")
extract_arg(args, "xmin")

def set_peek(self, dataset: "DatasetInstance", **kwd) -> None:
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
if not dataset.dataset.purged:
dataset.peek = get_file_peek(dataset.file_name)
dataset.info = (
Expand Down Expand Up @@ -198,7 +196,7 @@ def sniff_prefix(self, file_prefix: FilePrefix) -> bool:

return False

def set_meta(self, dataset: "DatasetInstance", overwrite: bool = True, **kwd) -> None:
def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> None:
"""
Extract metadata from TITLE
"""
Expand All @@ -210,7 +208,7 @@ def set_meta(self, dataset: "DatasetInstance", overwrite: bool = True, **kwd) ->

dataset.metadata.title_block = title_block

def set_peek(self, dataset: "DatasetInstance", **kwd) -> None:
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
if not dataset.dataset.purged:
dataset.peek = get_file_peek(dataset.file_name)
dataset.info = dataset.metadata.title_block
Expand Down

0 comments on commit cfab9e8

Please sign in to comment.