Skip to content

Commit

Permalink
new format style
Browse files Browse the repository at this point in the history
  • Loading branch information
LanderOtto committed Jan 27, 2024
1 parent aac539f commit 936c8bf
Show file tree
Hide file tree
Showing 31 changed files with 303 additions and 383 deletions.
1 change: 1 addition & 0 deletions streamflow/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Default entrypoint for the streamflow module."""

import sys

from streamflow import main
Expand Down
1 change: 1 addition & 0 deletions streamflow/core/asyncache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Helpers to use [cachetools](https://github.com/tkem/cachetools) with
asyncio.
"""

import functools
import inspect

Expand Down
3 changes: 1 addition & 2 deletions streamflow/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
class SchemaEntity(ABC):
@classmethod
@abstractmethod
def get_schema(cls) -> str:
...
def get_schema(cls) -> str: ...


class StreamFlowContext:
Expand Down
36 changes: 12 additions & 24 deletions streamflow/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def __init__(self, context: StreamFlowContext):
self.context: StreamFlowContext = context

@abstractmethod
async def close(self) -> None:
...
async def close(self) -> None: ...

@abstractmethod
def get_data_locations(
Expand All @@ -70,18 +69,15 @@ def get_data_locations(
deployment: str | None = None,
location_name: str | None = None,
data_type: DataType | None = None,
) -> MutableSequence[DataLocation]:
...
) -> MutableSequence[DataLocation]: ...

@abstractmethod
def get_source_location(
self, path: str, dst_deployment: str
) -> DataLocation | None:
...
) -> DataLocation | None: ...

@abstractmethod
def invalidate_location(self, location: Location, path: str) -> None:
...
def invalidate_location(self, location: Location, path: str) -> None: ...

@abstractmethod
def register_path(
Expand All @@ -90,14 +86,12 @@ def register_path(
path: str,
relpath: str | None = None,
data_type: DataType = DataType.PRIMARY,
) -> DataLocation:
...
) -> DataLocation: ...

@abstractmethod
def register_relation(
self, src_location: DataLocation, dst_location: DataLocation
) -> None:
...
) -> None: ...

@abstractmethod
async def transfer_data(
Expand All @@ -107,8 +101,7 @@ async def transfer_data(
dst_locations: MutableSequence[Location],
dst_path: str,
writable: bool = False,
) -> None:
...
) -> None: ...


class FileType(Enum):
Expand All @@ -121,23 +114,18 @@ def __init__(self, stream: Any):
self.stream: Any = stream

@abstractmethod
async def close(self):
...
async def close(self): ...

@abstractmethod
async def read(self, size: int | None = None):
...
async def read(self, size: int | None = None): ...

@abstractmethod
async def write(self, data: Any):
...
async def write(self, data: Any): ...


class StreamWrapperContextManager(ABC):
@abstractmethod
async def __aenter__(self) -> StreamWrapper:
...
async def __aenter__(self) -> StreamWrapper: ...

@abstractmethod
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
...
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: ...
42 changes: 14 additions & 28 deletions streamflow/core/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ class BindingFilter(SchemaEntity):
@abstractmethod
async def get_targets(
self, job: Job, targets: MutableSequence[Target]
) -> MutableSequence[Target]:
...
) -> MutableSequence[Target]: ...


class Connector(SchemaEntity):
Expand All @@ -79,8 +78,7 @@ async def copy_local_to_remote(
dst: str,
locations: MutableSequence[Location],
read_only: bool = False,
) -> None:
...
) -> None: ...

@abstractmethod
async def copy_remote_to_local(
Expand All @@ -89,8 +87,7 @@ async def copy_remote_to_local(
dst: str,
locations: MutableSequence[Location],
read_only: bool = False,
) -> None:
...
) -> None: ...

@abstractmethod
async def copy_remote_to_remote(
Expand All @@ -101,12 +98,10 @@ async def copy_remote_to_remote(
source_location: Location,
source_connector: Connector | None = None,
read_only: bool = False,
) -> None:
...
) -> None: ...

@abstractmethod
async def deploy(self, external: bool) -> None:
...
async def deploy(self, external: bool) -> None: ...

@abstractmethod
async def get_available_locations(
Expand All @@ -115,8 +110,7 @@ async def get_available_locations(
input_directory: str | None = None,
output_directory: str | None = None,
tmp_directory: str | None = None,
) -> MutableMapping[str, AvailableLocation]:
...
) -> MutableMapping[str, AvailableLocation]: ...

@abstractmethod
async def run(
Expand All @@ -131,43 +125,35 @@ async def run(
capture_output: bool = False,
timeout: int | None = None,
job_name: str | None = None,
) -> tuple[Any | None, int] | None:
...
) -> tuple[Any | None, int] | None: ...

@abstractmethod
async def undeploy(self, external: bool) -> None:
...
async def undeploy(self, external: bool) -> None: ...

@abstractmethod
async def get_stream_reader(
self, location: Location, src: str
) -> StreamWrapperContextManager:
...
) -> StreamWrapperContextManager: ...


class DeploymentManager(SchemaEntity):
def __init__(self, context: StreamFlowContext) -> None:
self.context: StreamFlowContext = context

@abstractmethod
async def close(self) -> None:
...
async def close(self) -> None: ...

@abstractmethod
async def deploy(self, deployment_config: DeploymentConfig) -> None:
...
async def deploy(self, deployment_config: DeploymentConfig) -> None: ...

@abstractmethod
def get_connector(self, deployment_name: str) -> Connector | None:
...
def get_connector(self, deployment_name: str) -> Connector | None: ...

@abstractmethod
async def undeploy(self, deployment_name: str) -> None:
...
async def undeploy(self, deployment_name: str) -> None: ...

@abstractmethod
async def undeploy_all(self):
...
async def undeploy_all(self): ...


class DeploymentConfig(Config, PersistableEntity):
Expand Down
12 changes: 6 additions & 6 deletions streamflow/core/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@


class WorkflowException(Exception):
...
pass


class WorkflowDefinitionException(WorkflowException):
...
pass


class WorkflowExecutionException(WorkflowException):
...
pass


class WorkflowProvenanceException(WorkflowException):
...
pass


class FailureHandlingException(WorkflowException):
...
pass


class InvalidPluginException(Exception):
...
pass


class UnrecoverableTokenException(WorkflowException):
Expand Down

0 comments on commit 936c8bf

Please sign in to comment.