diff --git a/examples/instantiate/object/my_app.py b/examples/instantiate/object/my_app.py index 593be34bed1..4917d7f5eac 100644 --- a/examples/instantiate/object/my_app.py +++ b/examples/instantiate/object/my_app.py @@ -6,8 +6,7 @@ class DBConnection: - def connect(self) -> None: - ... + def connect(self) -> None: ... class MySQLConnection(DBConnection): diff --git a/examples/plugins/example_sweeper_plugin/tests/test_example_sweeper_plugin.py b/examples/plugins/example_sweeper_plugin/tests/test_example_sweeper_plugin.py index 5073551e6d8..e9745af1dd6 100644 --- a/examples/plugins/example_sweeper_plugin/tests/test_example_sweeper_plugin.py +++ b/examples/plugins/example_sweeper_plugin/tests/test_example_sweeper_plugin.py @@ -52,8 +52,7 @@ def test_launched_jobs(hydra_sweep_runner: TSweepRunner) -> None: ) ], ) -class TestExampleSweeper(LauncherTestSuite): - ... +class TestExampleSweeper(LauncherTestSuite): ... # Many sweepers are batching jobs in groups. @@ -73,8 +72,7 @@ class TestExampleSweeper(LauncherTestSuite): ) ], ) -class TestExampleSweeperWithBatching(BatchedSweeperTestSuite): - ... +class TestExampleSweeperWithBatching(BatchedSweeperTestSuite): ... # Run integration test suite with the basic launcher and this sweeper diff --git a/hydra/_internal/config_repository.py b/hydra/_internal/config_repository.py index 3beb5e43238..fdfcdba9717 100644 --- a/hydra/_internal/config_repository.py +++ b/hydra/_internal/config_repository.py @@ -27,34 +27,27 @@ class IConfigRepository(ABC): @abstractmethod - def get_schema_source(self) -> ConfigSource: - ... + def get_schema_source(self) -> ConfigSource: ... @abstractmethod - def load_config(self, config_path: str) -> Optional[ConfigResult]: - ... + def load_config(self, config_path: str) -> Optional[ConfigResult]: ... @abstractmethod - def group_exists(self, config_path: str) -> bool: - ... + def group_exists(self, config_path: str) -> bool: ... @abstractmethod - def config_exists(self, config_path: str) -> bool: - ... + def config_exists(self, config_path: str) -> bool: ... @abstractmethod def get_group_options( self, group_name: str, results_filter: Optional[ObjectType] = ObjectType.CONFIG - ) -> List[str]: - ... + ) -> List[str]: ... @abstractmethod - def get_sources(self) -> List[ConfigSource]: - ... + def get_sources(self) -> List[ConfigSource]: ... @abstractmethod - def initialize_sources(self, config_search_path: ConfigSearchPath) -> None: - ... + def initialize_sources(self, config_search_path: ConfigSearchPath) -> None: ... class ConfigRepository(IConfigRepository): diff --git a/hydra/core/config_loader.py b/hydra/core/config_loader.py index 38ccf174794..3ee6914062f 100644 --- a/hydra/core/config_loader.py +++ b/hydra/core/config_loader.py @@ -23,26 +23,21 @@ def load_configuration( run_mode: RunMode, from_shell: bool = True, validate_sweep_overrides: bool = True, - ) -> DictConfig: - ... + ) -> DictConfig: ... @abstractmethod def load_sweep_config( self, master_config: DictConfig, sweep_overrides: List[str] - ) -> DictConfig: - ... + ) -> DictConfig: ... @abstractmethod - def get_search_path(self) -> ConfigSearchPath: - ... + def get_search_path(self) -> ConfigSearchPath: ... @abstractmethod - def get_sources(self) -> List[ConfigSource]: - ... + def get_sources(self) -> List[ConfigSource]: ... @abstractmethod - def list_groups(self, parent_name: str) -> List[str]: - ... + def list_groups(self, parent_name: str) -> List[str]: ... @abstractmethod def get_group_options( @@ -51,8 +46,7 @@ def get_group_options( results_filter: Optional[ObjectType] = ObjectType.CONFIG, config_name: Optional[str] = None, overrides: Optional[List[str]] = None, - ) -> List[str]: - ... + ) -> List[str]: ... @abstractmethod def compute_defaults_list( @@ -60,5 +54,4 @@ def compute_defaults_list( config_name: Optional[str], overrides: List[str], run_mode: RunMode, - ) -> Any: - ... + ) -> Any: ... diff --git a/hydra/core/config_search_path.py b/hydra/core/config_search_path.py index dd43a08499a..9fdac86127f 100644 --- a/hydra/core/config_search_path.py +++ b/hydra/core/config_search_path.py @@ -28,8 +28,7 @@ class SearchPathQuery: class ConfigSearchPath(ABC): @abstractmethod - def get_path(self) -> MutableSequence[SearchPathElement]: - ... + def get_path(self) -> MutableSequence[SearchPathElement]: ... @abstractmethod def append( diff --git a/hydra/core/config_store.py b/hydra/core/config_store.py index 3e73f469101..15e634a608e 100644 --- a/hydra/core/config_store.py +++ b/hydra/core/config_store.py @@ -28,8 +28,7 @@ def store( 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: ... @dataclass diff --git a/hydra/errors.py b/hydra/errors.py index 15cef9c72e7..81341887707 100644 --- a/hydra/errors.py +++ b/hydra/errors.py @@ -2,12 +2,10 @@ from typing import Optional, Sequence -class HydraException(Exception): - ... +class HydraException(Exception): ... -class CompactHydraException(HydraException): - ... +class CompactHydraException(HydraException): ... class OverrideParseException(CompactHydraException): @@ -17,16 +15,13 @@ def __init__(self, override: str, message: str) -> None: self.message = message -class InstantiationException(CompactHydraException): - ... +class InstantiationException(CompactHydraException): ... -class ConfigCompositionException(CompactHydraException): - ... +class ConfigCompositionException(CompactHydraException): ... -class SearchPathException(CompactHydraException): - ... +class SearchPathException(CompactHydraException): ... class MissingConfigException(IOError, ConfigCompositionException): @@ -41,5 +36,4 @@ def __init__( self.options = options -class HydraDeprecationError(HydraException): - ... +class HydraDeprecationError(HydraException): ... diff --git a/hydra/extra/pytest_plugin.py b/hydra/extra/pytest_plugin.py index 6366d2f8a1f..f01d5dbca93 100644 --- a/hydra/extra/pytest_plugin.py +++ b/hydra/extra/pytest_plugin.py @@ -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], @@ -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], diff --git a/hydra/initialize.py b/hydra/initialize.py index 7f8110db189..26a0cf8ae5a 100644 --- a/hydra/initialize.py +++ b/hydra/initialize.py @@ -95,8 +95,7 @@ def __init__( job_name=job_name, ) - def __enter__(self, *args: Any, **kwargs: Any) -> None: - ... + def __enter__(self, *args: Any, **kwargs: Any) -> None: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: restore_gh_from_backup(self._gh_backup) @@ -130,8 +129,7 @@ def __init__( job_name=job_name, ) - def __enter__(self, *args: Any, **kwargs: Any) -> None: - ... + def __enter__(self, *args: Any, **kwargs: Any) -> None: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: restore_gh_from_backup(self._gh_backup) @@ -169,8 +167,7 @@ def __init__( 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: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: restore_gh_from_backup(self._gh_backup) diff --git a/hydra/plugins/completion_plugin.py b/hydra/plugins/completion_plugin.py index 65b26b96b7a..8bc6138ef04 100644 --- a/hydra/plugins/completion_plugin.py +++ b/hydra/plugins/completion_plugin.py @@ -31,12 +31,10 @@ def __init__(self, config_loader: ConfigLoader) -> None: self.config_loader = config_loader @abstractmethod - def install(self) -> None: - ... + def install(self) -> None: ... @abstractmethod - def uninstall(self) -> None: - ... + def uninstall(self) -> None: ... @staticmethod @abstractmethod @@ -47,8 +45,7 @@ def provides() -> str: ... @abstractmethod - def query(self, config_name: Optional[str]) -> None: - ... + def query(self, config_name: Optional[str]) -> None: ... @staticmethod @abstractmethod diff --git a/hydra/plugins/config_source.py b/hydra/plugins/config_source.py index 0cef6c13007..182a3ec48a1 100644 --- a/hydra/plugins/config_source.py +++ b/hydra/plugins/config_source.py @@ -47,20 +47,17 @@ def scheme() -> str: ... @abstractmethod - def load_config(self, config_path: str) -> ConfigResult: - ... + def load_config(self, config_path: str) -> ConfigResult: ... # 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: ... @abstractmethod - def is_config(self, config_path: str) -> bool: - ... + def is_config(self, config_path: str) -> bool: ... @abstractmethod def available(self) -> bool: diff --git a/hydra/plugins/plugin.py b/hydra/plugins/plugin.py index 66f390a70f7..2f6d778ee68 100644 --- a/hydra/plugins/plugin.py +++ b/hydra/plugins/plugin.py @@ -2,5 +2,4 @@ from abc import ABC -class Plugin(ABC): - ... +class Plugin(ABC): ... diff --git a/hydra/plugins/search_path_plugin.py b/hydra/plugins/search_path_plugin.py index 28d2cfc8978..4e5effd36d4 100644 --- a/hydra/plugins/search_path_plugin.py +++ b/hydra/plugins/search_path_plugin.py @@ -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: ... diff --git a/hydra/test_utils/test_utils.py b/hydra/test_utils/test_utils.py index 7000fe9c15d..9c7c41c73f1 100644 --- a/hydra/test_utils/test_utils.py +++ b/hydra/test_utils/test_utils.py @@ -102,8 +102,7 @@ def __call__( config_name: Optional[str], overrides: Optional[List[str]] = None, configure_logging: bool = False, - ) -> TaskTestFunction: - ... + ) -> TaskTestFunction: ... class SweepTaskFunction: @@ -184,8 +183,7 @@ def __call__( config_name: Optional[str], overrides: Optional[List[str]], temp_dir: Optional[Path] = None, - ) -> SweepTaskFunction: - ... + ) -> SweepTaskFunction: ... def chdir_hydra_root(subdir: Optional[str] = None) -> None: diff --git a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py index 37329424a1f..f3c14b1e8c4 100644 --- a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py +++ b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py @@ -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 diff --git a/plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py b/plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py index bc6a382fbfd..c06aa2c67e5 100644 --- a/plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py +++ b/plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py @@ -329,7 +329,6 @@ class TestRayAWSLauncher(LauncherTestSuite): ], ) class TestRayAWSLauncherIntegration(IntegrationTestSuite): - """ Run this launcher through the integration test suite. """ diff --git a/tests/data.py b/tests/data.py index 6aa20225508..6598636e38b 100644 --- a/tests/data.py +++ b/tests/data.py @@ -1,17 +1,14 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -def foo() -> None: - ... +def foo() -> None: ... -def foo_main_module() -> None: - ... +def foo_main_module() -> None: ... foo_main_module.__module__ = "__main__" -class Bar: - ... +class Bar: ... bar_instance = Bar() diff --git a/tests/instantiate/__init__.py b/tests/instantiate/__init__.py index ac5479bd67c..632b27696ff 100644 --- a/tests/instantiate/__init__.py +++ b/tests/instantiate/__init__.py @@ -232,8 +232,7 @@ class UserGroup: # RECURSIVE # Classes -class Transform: - ... +class Transform: ... class CenterCrop(Transform): @@ -318,8 +317,7 @@ def __repr__(self) -> str: # Configs @dataclass -class TransformConf: - ... +class TransformConf: ... @dataclass diff --git a/tests/instantiate/positional_only.py b/tests/instantiate/positional_only.py index 87e3759d0bf..03ca6698208 100644 --- a/tests/instantiate/positional_only.py +++ b/tests/instantiate/positional_only.py @@ -33,8 +33,7 @@ def __eq__(self, other: Any) -> Any: # Dummy class to keep mypy happy class PosOnlyArgsClass: - def __init__(self, *args: Any, **kwargs: Any) -> None: - ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... exec(code) # nosec diff --git a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/__not_hidden_plugin.py b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/__not_hidden_plugin.py index 9c2c1d0009a..5d1bc722ed4 100644 --- a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/__not_hidden_plugin.py +++ b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/__not_hidden_plugin.py @@ -2,5 +2,4 @@ from hydra.plugins.plugin import Plugin -class NotHiddenTestPlugin(Plugin): - ... +class NotHiddenTestPlugin(Plugin): ... diff --git a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/_hidden_plugin.py b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/_hidden_plugin.py index c732049ce23..1295766d5d1 100644 --- a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/_hidden_plugin.py +++ b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/_hidden_plugin.py @@ -2,5 +2,4 @@ from hydra.plugins.plugin import Plugin -class HiddenTestPlugin(Plugin): - ... +class HiddenTestPlugin(Plugin): ... diff --git a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/discovery_test.py b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/discovery_test.py index e876ecabe83..f9f24a65f55 100644 --- a/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/discovery_test.py +++ b/tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/discovery_test.py @@ -9,5 +9,4 @@ f.write("imported\n") -class DiscoveryTestPlugin(Plugin): - ... +class DiscoveryTestPlugin(Plugin): ... diff --git a/tests/test_basic_launcher.py b/tests/test_basic_launcher.py index c7f49dc552b..f8b44c28bfa 100644 --- a/tests/test_basic_launcher.py +++ b/tests/test_basic_launcher.py @@ -48,5 +48,4 @@ class TestBasicLauncherIntegration(IntegrationTestSuite): ) ], ) -class TestBasicSweeperWithBatching(BatchedSweeperTestSuite): - ... +class TestBasicSweeperWithBatching(BatchedSweeperTestSuite): ... diff --git a/tests/test_plugin_interface.py b/tests/test_plugin_interface.py index 8f1bb056f13..6d8fdf28e0b 100644 --- a/tests/test_plugin_interface.py +++ b/tests/test_plugin_interface.py @@ -36,8 +36,7 @@ def test_discover(plugin_type: Type[Plugin], expected: List[str]) -> None: def test_register_plugin() -> None: class MyPlugin(SearchPathPlugin): - def manipulate_search_path(self, search_path: ConfigSearchPath) -> None: - ... + def manipulate_search_path(self, search_path: ConfigSearchPath) -> None: ... Plugins.instance().register(MyPlugin) @@ -47,8 +46,7 @@ def manipulate_search_path(self, search_path: ConfigSearchPath) -> None: def test_register_bad_plugin() -> None: - class NotAPlugin: - ... + class NotAPlugin: ... with raises(ValueError, match="Not a valid Hydra Plugin"): Plugins.instance().register(NotAPlugin) # type: ignore diff --git a/tools/configen/tests/test_modules/__init__.py b/tools/configen/tests/test_modules/__init__.py index 0de1ec2dee1..13b578023f6 100644 --- a/tools/configen/tests/test_modules/__init__.py +++ b/tools/configen/tests/test_modules/__init__.py @@ -31,8 +31,7 @@ def __eq__(self, other): class Empty: - def __init__(self): - ... + def __init__(self): ... def __eq__(self, other): return isinstance(other, type(self))