Skip to content

Commit

Permalink
mypy fixes...
Browse files Browse the repository at this point in the history
dddd

h dear...
  • Loading branch information
jmchilton committed Sep 10, 2024
1 parent 669c65c commit 869620f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/model/deferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ def ensure_materialized(
except DetachedInstanceError:
history = None

materialized_dataset_instance: Union[HistoryDatasetAssociation, LibraryDatasetDatasetAssociation]
materialized_dataset_instance: HistoryDatasetAssociation
if not in_place:
materialized_dataset_instance = HistoryDatasetAssociation(
create_dataset=False, # is the default but lets make this really clear...
history=history,
)
else:
materialized_dataset_instance = dataset_instance
assert isinstance(dataset_instance, HistoryDatasetAssociation)
materialized_dataset_instance = cast(HistoryDatasetAssociation, dataset_instance)
if attached:
sa_session = self._sa_session
if sa_session is None:
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/tool_util/parameters/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .models import (
DataCollectionRequest,
DataParameterModel,
DataRequest,
DataRequestHda,
DataRequestInternalHda,
DataRequestUri,
SelectParameterModel,
Expand Down Expand Up @@ -156,7 +156,7 @@ def dereference_callback(parameter: ToolParameterT, value: Any):

# interfaces for adapting test data dictionaries to tool request dictionaries
# e.g. {class: File, path: foo.bed} => {src: hda, id: ab1235cdfea3}
AdaptDatasets = Callable[[JsonTestDatasetDefDict], DataRequest]
AdaptDatasets = Callable[[JsonTestDatasetDefDict], DataRequestHda]
AdaptCollections = Callable[[JsonTestCollectionDefDict], DataCollectionRequest]


Expand Down
28 changes: 14 additions & 14 deletions lib/galaxy/tool_util/parameters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,18 +269,18 @@ class DataRequestUri(StrictModel):
deferred: StrictBool = False


DataRequest: Type = Annotated[union_type([DataRequestHda, DataRequestLdda, DataRequestUri]), Field(discriminator="src")]
DataRequest: Type = cast(Type, Annotated[union_type([DataRequestHda, DataRequestLdda, DataRequestUri]), Field(discriminator="src")])


class BatchDataInstance(StrictModel):
src: MultiDataSrcT
id: StrictStr


MultiDataInstance: Type = Annotated[
MultiDataInstance: Type = cast(Type, Annotated[
union_type([DataRequestHda, DataRequestLdda, DataRequestHdca, DataRequestUri]), Field(discriminator="src")
]
MultiDataRequest: Type = union_type([MultiDataInstance, List[MultiDataInstance]])
])
MultiDataRequest: Type = cast(Type, union_type([MultiDataInstance, list_type(MultiDataInstance)]))


class DataRequestInternalHda(StrictModel):
Expand All @@ -298,12 +298,12 @@ class DataRequestInternalHdca(StrictModel):
id: StrictInt


DataRequestInternal = Annotated[
DataRequestInternal: Type = cast(Type, Annotated[
Union[DataRequestInternalHda, DataRequestInternalLdda, DataRequestUri], Field(discriminator="src")
]
DataRequestInternalDereferenced = Annotated[
])
DataRequestInternalDereferenced: Type = cast(Type, Annotated[
Union[DataRequestInternalHda, DataRequestInternalLdda], Field(discriminator="src")
]
])
DataJobInternal = DataRequestInternalDereferenced


Expand All @@ -312,17 +312,17 @@ class BatchDataInstanceInternal(StrictModel):
id: StrictInt


MultiDataInstanceInternal = Annotated[
MultiDataInstanceInternal: Type = cast(Type, Annotated[
Union[DataRequestInternalHda, DataRequestInternalLdda, DataRequestInternalHdca, DataRequestUri],
Field(discriminator="src"),
]
MultiDataInstanceInternalDereferenced = Annotated[
])
MultiDataInstanceInternalDereferenced: Type = cast(Type, Annotated[
Union[DataRequestInternalHda, DataRequestInternalLdda, DataRequestInternalHdca], Field(discriminator="src")
]
])

MultiDataRequestInternal: Type = union_type([MultiDataInstanceInternal, List[MultiDataInstanceInternal]])
MultiDataRequestInternal: Type = union_type([MultiDataInstanceInternal, list_type(MultiDataInstanceInternal)])
MultiDataRequestInternalDereferenced: Type = union_type(
[MultiDataInstanceInternalDereferenced, List[MultiDataInstanceInternalDereferenced]]
[MultiDataInstanceInternalDereferenced, list_type(MultiDataInstanceInternalDereferenced)]
)


Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
input_models_for_pages,
JobInternalToolState,
RequestInternalDereferencedToolState,
RequestInternalToolState,
ToolParameterBundle,
)
from galaxy.tool_util.parser import (
Expand Down Expand Up @@ -1836,7 +1835,7 @@ def visit_inputs(self, values, callback):
def expand_incoming_async(
self,
request_context: WorkRequestContext,
tool_request_internal_state: RequestInternalToolState,
tool_request_internal_state: RequestInternalDereferencedToolState,
rerun_remap_job_id: Optional[int],
) -> Tuple[
List[ToolStateJobInstancePopulatedT],
Expand Down

0 comments on commit 869620f

Please sign in to comment.