Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update formatting with black v24.2.0 #2853

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/instantiate/object/my_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@


class DBConnection:
def connect(self) -> None:
...
def connect(self) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class MySQLConnection(DBConnection):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
)
],
)
class TestExampleSweeper(LauncherTestSuite):
...
class TestExampleSweeper(LauncherTestSuite): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


# Many sweepers are batching jobs in groups.
Expand All @@ -73,8 +72,7 @@
)
],
)
class TestExampleSweeperWithBatching(BatchedSweeperTestSuite):
...
class TestExampleSweeperWithBatching(BatchedSweeperTestSuite): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


# Run integration test suite with the basic launcher and this sweeper
Expand Down
21 changes: 7 additions & 14 deletions hydra/_internal/config_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,27 @@

class IConfigRepository(ABC):
@abstractmethod
def get_schema_source(self) -> ConfigSource:
...
def get_schema_source(self) -> ConfigSource: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def load_config(self, config_path: str) -> Optional[ConfigResult]:
...
def load_config(self, config_path: str) -> Optional[ConfigResult]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def group_exists(self, config_path: str) -> bool:
...
def group_exists(self, config_path: str) -> bool: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def config_exists(self, config_path: str) -> bool:
...
def config_exists(self, config_path: str) -> bool: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_group_options(
self, group_name: str, results_filter: Optional[ObjectType] = ObjectType.CONFIG
) -> List[str]:
...
) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_sources(self) -> List[ConfigSource]:
...
def get_sources(self) -> List[ConfigSource]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def initialize_sources(self, config_search_path: ConfigSearchPath) -> None:
...
def initialize_sources(self, config_search_path: ConfigSearchPath) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class ConfigRepository(IConfigRepository):
Expand Down
21 changes: 7 additions & 14 deletions hydra/core/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,21 @@
run_mode: RunMode,
from_shell: bool = True,
validate_sweep_overrides: bool = True,
) -> DictConfig:
...
) -> DictConfig: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def load_sweep_config(
self, master_config: DictConfig, sweep_overrides: List[str]
) -> DictConfig:
...
) -> DictConfig: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_search_path(self) -> ConfigSearchPath:
...
def get_search_path(self) -> ConfigSearchPath: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_sources(self) -> List[ConfigSource]:
...
def get_sources(self) -> List[ConfigSource]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def list_groups(self, parent_name: str) -> List[str]:
...
def list_groups(self, parent_name: str) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_group_options(
Expand All @@ -51,14 +46,12 @@
results_filter: Optional[ObjectType] = ObjectType.CONFIG,
config_name: Optional[str] = None,
overrides: Optional[List[str]] = None,
) -> List[str]:
...
) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def compute_defaults_list(
self,
config_name: Optional[str],
overrides: List[str],
run_mode: RunMode,
) -> Any:
...
) -> Any: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
3 changes: 1 addition & 2 deletions hydra/core/config_search_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

class ConfigSearchPath(ABC):
@abstractmethod
def get_path(self) -> MutableSequence[SearchPathElement]:
...
def get_path(self) -> MutableSequence[SearchPathElement]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def append(
Expand Down
3 changes: 1 addition & 2 deletions hydra/core/config_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
group=group, name=name, node=node, package=package, provider=self.provider
)

def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> Any:
...
def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> Any: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@dataclass
Expand Down
18 changes: 6 additions & 12 deletions hydra/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
from typing import Optional, Sequence


class HydraException(Exception):
...
class HydraException(Exception): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class CompactHydraException(HydraException):
...
class CompactHydraException(HydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class OverrideParseException(CompactHydraException):
Expand All @@ -17,16 +15,13 @@
self.message = message


class InstantiationException(CompactHydraException):
...
class InstantiationException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class ConfigCompositionException(CompactHydraException):
...
class ConfigCompositionException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class SearchPathException(CompactHydraException):
...
class SearchPathException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class MissingConfigException(IOError, ConfigCompositionException):
Expand All @@ -41,5 +36,4 @@
self.options = options


class HydraDeprecationError(HydraException):
...
class HydraDeprecationError(HydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
52 changes: 24 additions & 28 deletions hydra/extra/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ def hydra_restore_singletons() -> Generator[None, None, None]:


@fixture(scope="function")
def hydra_sweep_runner() -> (
Callable[
[
Optional[str],
Optional[str],
Optional[TaskFunction],
Optional[str],
Optional[str],
Optional[List[str]],
Optional[Path],
bool,
],
SweepTaskFunction,
]
):
def hydra_sweep_runner() -> Callable[
[
Optional[str],
Optional[str],
Optional[TaskFunction],
Optional[str],
Optional[str],
Optional[List[str]],
Optional[Path],
bool,
],
SweepTaskFunction,
]:
def _(
calling_file: Optional[str],
calling_module: Optional[str],
Expand All @@ -61,19 +59,17 @@ def _(


@fixture(scope="function")
def hydra_task_runner() -> (
Callable[
[
Optional[str],
Optional[str],
Optional[str],
Optional[str],
Optional[List[str]],
bool,
],
TaskTestFunction,
]
):
def hydra_task_runner() -> Callable[
[
Optional[str],
Optional[str],
Optional[str],
Optional[str],
Optional[List[str]],
bool,
],
TaskTestFunction,
]:
def _(
calling_file: Optional[str],
calling_module: Optional[str],
Expand Down
9 changes: 3 additions & 6 deletions hydra/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
job_name=job_name,
)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
...
def __enter__(self, *args: Any, **kwargs: Any) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
restore_gh_from_backup(self._gh_backup)
Expand Down Expand Up @@ -130,8 +129,7 @@
job_name=job_name,
)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
...
def __enter__(self, *args: Any, **kwargs: Any) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
restore_gh_from_backup(self._gh_backup)
Expand Down Expand Up @@ -169,8 +167,7 @@
csp = create_config_search_path(search_path_dir=config_dir)
Hydra.create_main_hydra2(task_name=job_name, config_search_path=csp)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
...
def __enter__(self, *args: Any, **kwargs: Any) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
restore_gh_from_backup(self._gh_backup)
Expand Down
9 changes: 3 additions & 6 deletions hydra/plugins/completion_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@
self.config_loader = config_loader

@abstractmethod
def install(self) -> None:
...
def install(self) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def uninstall(self) -> None:
...
def uninstall(self) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@staticmethod
@abstractmethod
Expand All @@ -47,8 +45,7 @@
...

@abstractmethod
def query(self, config_name: Optional[str]) -> None:
...
def query(self, config_name: Optional[str]) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@staticmethod
@abstractmethod
Expand Down
9 changes: 3 additions & 6 deletions hydra/plugins/config_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,17 @@
...

@abstractmethod
def load_config(self, config_path: str) -> ConfigResult:
...
def load_config(self, config_path: str) -> ConfigResult: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

# subclasses may override to improve performance
def exists(self, config_path: str) -> bool:
return self.is_group(config_path) or self.is_config(config_path)

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

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def is_config(self, config_path: str) -> bool:
...
def is_config(self, config_path: str) -> bool: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def available(self) -> bool:
Expand Down
3 changes: 1 addition & 2 deletions hydra/plugins/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
from abc import ABC


class Plugin(ABC):
...
class Plugin(ABC): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
3 changes: 1 addition & 2 deletions hydra/plugins/search_path_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

class SearchPathPlugin(Plugin):
@abstractmethod
def manipulate_search_path(self, search_path: ConfigSearchPath) -> None:
...
def manipulate_search_path(self, search_path: ConfigSearchPath) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
6 changes: 2 additions & 4 deletions hydra/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@
config_name: Optional[str],
overrides: Optional[List[str]] = None,
configure_logging: bool = False,
) -> TaskTestFunction:
...
) -> TaskTestFunction: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


class SweepTaskFunction:
Expand Down Expand Up @@ -184,8 +183,7 @@
config_name: Optional[str],
overrides: Optional[List[str]],
temp_dir: Optional[Path] = None,
) -> SweepTaskFunction:
...
) -> SweepTaskFunction: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


def chdir_hydra_root(subdir: Optional[str] = None) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def sweep(self, arguments: List[str]) -> None:
parsed = parser.parse_overrides(arguments)

for override in parsed:
params[
override.get_key_element()
] = create_nevergrad_parameter_from_override(override)
params[override.get_key_element()] = (
create_nevergrad_parameter_from_override(override)
)

parametrization = ng.p.Dict(**params)
parametrization.function.deterministic = not self.opt_config.noisy
Expand Down
1 change: 0 additions & 1 deletion plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ class TestRayAWSLauncher(LauncherTestSuite):
],
)
class TestRayAWSLauncherIntegration(IntegrationTestSuite):

"""
Run this launcher through the integration test suite.
"""
Expand Down
Loading
Loading