Skip to content

Commit

Permalink
update to latest black
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Jul 4, 2024
1 parent 32c7276 commit 9478a8a
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 136 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ throttler = "^1.2.2"
snakemake-interface-common = "^1.12.0"

[tool.poetry.dev-dependencies]
black = "^22.1.0"
black = "^24.0.0"
coverage = {extras = ["toml"], version = "^6.3.1"}
flake8 = "^4.0.1"
flake8-bugbear = "^22.1.11"
Expand Down
9 changes: 3 additions & 6 deletions snakemake_interface_executor_plugins/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ class SpawnedJobArgsFactoryExecutorInterface(ABC):
def general_args(
self,
executor_common_settings: CommonSettings,
) -> str:
...
) -> str: ...

@abstractmethod
def precommand(self, executor_common_settings: CommonSettings) -> str:
...
def precommand(self, executor_common_settings: CommonSettings) -> str: ...

@abstractmethod
def envvars(self) -> Mapping[str, str]:
...
def envvars(self) -> Mapping[str, str]: ...
9 changes: 3 additions & 6 deletions snakemake_interface_executor_plugins/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@

class DAGExecutorInterface(ABC):
@abstractmethod
def incomplete_external_jobid(self, job: JobExecutorInterface) -> Optional[str]:
...
def incomplete_external_jobid(self, job: JobExecutorInterface) -> Optional[str]: ...

@abstractmethod
def get_sources(self) -> Iterable[str]:
...
def get_sources(self) -> Iterable[str]: ...

@abstractmethod
def get_unneeded_temp_files(self, job: JobExecutorInterface) -> Iterable[str]:
...
def get_unneeded_temp_files(self, job: JobExecutorInterface) -> Iterable[str]: ...
12 changes: 4 additions & 8 deletions snakemake_interface_executor_plugins/executors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ def report_job_submission(self, job_info: SubmittedJobInfo):
self.workflow.scheduler.submit_callback(job_info.job)

@abstractmethod
def shutdown(self):
...
def shutdown(self): ...

@abstractmethod
def cancel(self):
...
def cancel(self): ...

def rule_prefix(self, job: JobExecutorInterface):
return "local " if job.is_local else ""
Expand All @@ -113,9 +111,7 @@ def print_job_error(self, job_info: SubmittedJobInfo, msg=None, **kwargs):
job_info.job.log_error(msg, **kwargs)

@abstractmethod
def handle_job_success(self, job: JobExecutorInterface):
...
def handle_job_success(self, job: JobExecutorInterface): ...

@abstractmethod
def handle_job_error(self, job: JobExecutorInterface):
...
def handle_job_error(self, job: JobExecutorInterface): ...
6 changes: 2 additions & 4 deletions snakemake_interface_executor_plugins/executors/real.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ def get_snakefile(self):
return self.snakefile

@abstractmethod
def get_python_executable(self):
...
def get_python_executable(self): ...

@abstractmethod
def get_exec_mode(self) -> ExecMode:
...
def get_exec_mode(self) -> ExecMode: ...

@property
def common_settings(self):
Expand Down
81 changes: 27 additions & 54 deletions snakemake_interface_executor_plugins/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,131 +15,104 @@ class JobExecutorInterface(ABC):

@property
@abstractmethod
def name(self) -> str:
...
def name(self) -> str: ...

@property
@abstractmethod
def jobid(self) -> int:
...
def jobid(self) -> int: ...

@abstractmethod
def logfile_suggestion(self, prefix: str) -> str:
...
def logfile_suggestion(self, prefix: str) -> str: ...

@abstractmethod
def is_group(self) -> bool:
...
def is_group(self) -> bool: ...

@abstractmethod
def log_info(self, skip_dynamic: bool = False) -> None:
...
def log_info(self, skip_dynamic: bool = False) -> None: ...

@abstractmethod
def log_error(self, msg: Optional[str] = None, **kwargs) -> None:
...
def log_error(self, msg: Optional[str] = None, **kwargs) -> None: ...

@abstractmethod
def properties(
self, omit_resources: Sequence[str] = ("_cores", "_nodes"), **aux_properties
) -> Mapping[str, Any]:
...
) -> Mapping[str, Any]: ...

@property
@abstractmethod
def resources(self) -> Mapping[str, Union[int, str]]:
...
def resources(self) -> Mapping[str, Union[int, str]]: ...

@property
@abstractmethod
def is_local(self) -> bool:
...
def is_local(self) -> bool: ...

@property
@abstractmethod
def is_updated(self) -> bool:
...
def is_updated(self) -> bool: ...

@property
@abstractmethod
def output(self) -> Iterable[str]:
...
def output(self) -> Iterable[str]: ...

@abstractmethod
def register(self, external_jobid: Optional[str] = None) -> None:
...
def register(self, external_jobid: Optional[str] = None) -> None: ...

@abstractmethod
def get_target_spec(self) -> str:
...
def get_target_spec(self) -> str: ...

@abstractmethod
def rules(self) -> Iterable[RuleInterface]:
...
def rules(self) -> Iterable[RuleInterface]: ...

@property
@abstractmethod
def attempt(self) -> int:
...
def attempt(self) -> int: ...

@property
@abstractmethod
def input(self) -> Iterable[str]:
...
def input(self) -> Iterable[str]: ...

@property
@abstractmethod
def threads(self) -> int:
...
def threads(self) -> int: ...

@property
@abstractmethod
def log(self) -> Iterable[str]:
...
def log(self) -> Iterable[str]: ...

@abstractmethod
def get_wait_for_files(self) -> Iterable[str]:
...
def get_wait_for_files(self) -> Iterable[str]: ...

@abstractmethod
def format_wildcards(self, string, **variables) -> str:
...
def format_wildcards(self, string, **variables) -> str: ...

@property
@abstractmethod
def is_containerized(self) -> bool:
...
def is_containerized(self) -> bool: ...


class SingleJobExecutorInterface(ABC):
@property
@abstractmethod
def rule(self) -> RuleInterface:
...
def rule(self) -> RuleInterface: ...

@property
@abstractmethod
def benchmark(self) -> Optional[str]:
...
def benchmark(self) -> Optional[str]: ...

@property
@abstractmethod
def message(self):
...
def message(self): ...


class GroupJobExecutorInterface(ABC):
@property
@abstractmethod
def jobs(self):
...
def jobs(self): ...

@property
@abstractmethod
def groupid(self):
...
def groupid(self): ...

@property
@abstractmethod
def toposorted(self):
...
def toposorted(self): ...
9 changes: 3 additions & 6 deletions snakemake_interface_executor_plugins/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@

class LoggerExecutorInterface(ABC):
@abstractmethod
def info(self, msg: str) -> None:
...
def info(self, msg: str) -> None: ...

@abstractmethod
def error(self, msg: str) -> None:
...
def error(self, msg: str) -> None: ...

@abstractmethod
def debug(self, msg: str) -> None:
...
def debug(self, msg: str) -> None: ...
6 changes: 2 additions & 4 deletions snakemake_interface_executor_plugins/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
class PersistenceExecutorInterface(ABC):
@property
@abstractmethod
def path(self) -> Path:
...
def path(self) -> Path: ...

@property
@abstractmethod
def aux_path(self) -> Path:
...
def aux_path(self) -> Path: ...
3 changes: 1 addition & 2 deletions snakemake_interface_executor_plugins/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

class JobSchedulerExecutorInterface(ABC):
@abstractmethod
def executor_error_callback(self, exception: Exception) -> None:
...
def executor_error_callback(self, exception: Exception) -> None: ...
30 changes: 10 additions & 20 deletions snakemake_interface_executor_plugins/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,33 +95,27 @@ class ExecutorSettingsBase(
class RemoteExecutionSettingsExecutorInterface(ABC):
@property
@abstractmethod
def jobname(self) -> str:
...
def jobname(self) -> str: ...

@property
@abstractmethod
def jobscript(self) -> str:
...
def jobscript(self) -> str: ...

@property
@abstractmethod
def immediate_submit(self) -> bool:
...
def immediate_submit(self) -> bool: ...

@property
@abstractmethod
def envvars(self) -> Sequence[str]:
...
def envvars(self) -> Sequence[str]: ...

@property
@abstractmethod
def max_status_checks_per_second(self) -> float:
...
def max_status_checks_per_second(self) -> float: ...

@property
@abstractmethod
def seconds_between_status_checks(self) -> int:
...
def seconds_between_status_checks(self) -> int: ...


class ExecMode(SettingsEnumBase):
Expand All @@ -138,8 +132,7 @@ class ExecMode(SettingsEnumBase):
class ExecutionSettingsExecutorInterface(ABC):
@property
@abstractmethod
def keep_incomplete(self) -> bool:
...
def keep_incomplete(self) -> bool: ...


class SharedFSUsage(SettingsEnumBase):
Expand Down Expand Up @@ -169,8 +162,7 @@ def _parse_choices_into(cls, choices: str, container) -> List[TSettingsEnumBase]
class StorageSettingsExecutorInterface(ABC):
@property
@abstractmethod
def shared_fs_usage(self) -> Set[SharedFSUsage]:
...
def shared_fs_usage(self) -> Set[SharedFSUsage]: ...

@property
def assume_common_workdir(self) -> bool:
Expand All @@ -193,12 +185,10 @@ class DeploymentMethod(SettingsEnumBase):
class DeploymentSettingsExecutorInterface(ABC):
@property
@abstractmethod
def deployment_method(self) -> Set[DeploymentMethod]:
...
def deployment_method(self) -> Set[DeploymentMethod]: ...


class GroupSettingsExecutorInterface(ABC):
@property
@abstractmethod
def local_groupid(self) -> str:
...
def local_groupid(self) -> str: ...
4 changes: 3 additions & 1 deletion snakemake_interface_executor_plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def encode_target_jobs_cli_args(
target_jobs: List[TargetSpec],
) -> List[str]:
items = []

def add_quotes_if_contains_comma(s):
if isinstance(s, str):
if "," in s:
Expand All @@ -105,7 +106,8 @@ def add_quotes_if_contains_comma(s):

for spec in target_jobs:
wildcards = ",".join(
f'{key}={add_quotes_if_contains_comma(value)}' for key, value in spec.wildcards_dict.items()
f"{key}={add_quotes_if_contains_comma(value)}"
for key, value in spec.wildcards_dict.items()
)
items.append(f"{spec.rulename}:{wildcards}")
return items
Expand Down
Loading

0 comments on commit 9478a8a

Please sign in to comment.