diff --git a/examples/advanced/hydra_app_example/tests/test_installed_app.py b/examples/advanced/hydra_app_example/tests/test_installed_app.py index cd3bd6ab6fe..633410099af 100644 --- a/examples/advanced/hydra_app_example/tests/test_installed_app.py +++ b/examples/advanced/hydra_app_example/tests/test_installed_app.py @@ -8,7 +8,6 @@ # when installed and executed from the command line. # You don't need to repeat those tests in your own app. class TestAppOutput: - # Testing the Hydra app as an executable script # This only works if we are at the root of the hydra-app-example def test_python_run(self, tmpdir: str) -> None: diff --git a/examples/plugins/example_configsource_plugin/hydra_plugins/example_configsource_plugin/example_configsource_plugin.py b/examples/plugins/example_configsource_plugin/hydra_plugins/example_configsource_plugin/example_configsource_plugin.py index 347676ab061..69e904cc8d7 100644 --- a/examples/plugins/example_configsource_plugin/hydra_plugins/example_configsource_plugin/example_configsource_plugin.py +++ b/examples/plugins/example_configsource_plugin/hydra_plugins/example_configsource_plugin/example_configsource_plugin.py @@ -105,7 +105,6 @@ def is_config(self, config_path: str) -> bool: return config_path in configs def list(self, config_path: str, results_filter: Optional[ObjectType]) -> List[str]: - groups: Dict[str, List[str]] = { "": ["dataset", "level1", "optimizer"], "dataset": [], diff --git a/hydra/_internal/config_repository.py b/hydra/_internal/config_repository.py index 7b3c3138d83..3beb5e43238 100644 --- a/hydra/_internal/config_repository.py +++ b/hydra/_internal/config_repository.py @@ -58,7 +58,6 @@ def initialize_sources(self, config_search_path: ConfigSearchPath) -> None: class ConfigRepository(IConfigRepository): - config_search_path: ConfigSearchPath sources: List[ConfigSource] diff --git a/hydra/_internal/core_plugins/basic_sweeper.py b/hydra/_internal/core_plugins/basic_sweeper.py index d92256f47c8..afa2b506045 100644 --- a/hydra/_internal/core_plugins/basic_sweeper.py +++ b/hydra/_internal/core_plugins/basic_sweeper.py @@ -107,7 +107,6 @@ def split_overrides_to_chunks( def split_arguments( overrides: List[Override], max_batch_size: Optional[int] ) -> List[List[List[str]]]: - lists = [] final_overrides = OrderedDict() for override in overrides: diff --git a/hydra/_internal/defaults_list.py b/hydra/_internal/defaults_list.py index 8ca6e86d54f..b4b0d92c950 100644 --- a/hydra/_internal/defaults_list.py +++ b/hydra/_internal/defaults_list.py @@ -710,7 +710,6 @@ def _create_defaults_list( prepend_hydra: bool, skip_missing: bool, ) -> Tuple[List[ResultDefault], DefaultsTreeNode]: - root = _create_root(config_name=config_name, with_hydra=prepend_hydra) defaults_tree = _create_defaults_tree( diff --git a/hydra/_internal/hydra.py b/hydra/_internal/hydra.py index b9716d54787..eb2d1c7db77 100644 --- a/hydra/_internal/hydra.py +++ b/hydra/_internal/hydra.py @@ -620,7 +620,6 @@ def _print_all_info( overrides: List[str], run_mode: RunMode = RunMode.RUN, ) -> None: - from .. import __version__ self._log_header(f"Hydra {__version__}", filler="=") diff --git a/hydra/_internal/utils.py b/hydra/_internal/utils.py index 3b331f74c56..eeb8ab533cf 100644 --- a/hydra/_internal/utils.py +++ b/hydra/_internal/utils.py @@ -37,7 +37,6 @@ def _get_module_name_override() -> Optional[str]: def detect_calling_file_or_module_from_task_function( task_function: Any, ) -> Tuple[Optional[str], Optional[str]]: - # if function is decorated, unwrap it while hasattr(task_function, "__wrapped__"): task_function = task_function.__wrapped__ @@ -65,7 +64,6 @@ def detect_calling_file_or_module_from_task_function( def detect_calling_file_or_module_from_stack_frame( stack_depth: int, ) -> Tuple[Optional[str], Optional[str]]: - stack = inspect.stack() frame = stack[stack_depth] if is_notebook() and "_dh" in frame[0].f_globals: @@ -102,7 +100,6 @@ def is_notebook() -> bool: def detect_task_name(calling_file: Optional[str], calling_module: Optional[str]) -> str: - if calling_file is not None: target_file = os.path.basename(calling_file) task_name = get_valid_filename(os.path.splitext(target_file)[0]) @@ -310,7 +307,6 @@ def _run_hydra( config_name: Optional[str], caller_stack_depth: int = 2, ) -> None: - from hydra.core.global_hydra import GlobalHydra from .hydra import Hydra diff --git a/hydra/core/override_parser/types.py b/hydra/core/override_parser/types.py index af8071b4cdf..3f41bf516cb 100644 --- a/hydra/core/override_parser/types.py +++ b/hydra/core/override_parser/types.py @@ -291,7 +291,6 @@ def _convert_value(value: ParsedElementType) -> Optional[ElementType]: if isinstance(value, list): return [Override._convert_value(x) for x in value] elif isinstance(value, dict): - return { # We ignore potential type mismatch here so as to let OmegaConf # raise an explicit error in case of invalid type. diff --git a/hydra/core/plugins.py b/hydra/core/plugins.py index be1cdd5b799..e63a35eaebd 100644 --- a/hydra/core/plugins.py +++ b/hydra/core/plugins.py @@ -121,7 +121,6 @@ def _instantiate(self, config: DictConfig) -> Plugin: @staticmethod def is_in_toplevel_plugins_module(clazz: str) -> bool: - return clazz.startswith("hydra_plugins.") or clazz.startswith( "hydra._internal.core_plugins." ) @@ -164,7 +163,6 @@ def instantiate_launcher( def _scan_all_plugins( modules: List[Any], ) -> Tuple[List[Type[Plugin]], ScanStats]: - stats = ScanStats() stats.total_time = timer() diff --git a/hydra/extra/pytest_plugin.py b/hydra/extra/pytest_plugin.py index f01d5dbca93..6366d2f8a1f 100644 --- a/hydra/extra/pytest_plugin.py +++ b/hydra/extra/pytest_plugin.py @@ -21,19 +21,21 @@ 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], @@ -59,17 +61,19 @@ 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/plugins/completion_plugin.py b/hydra/plugins/completion_plugin.py index 0f3ab8837f5..328f03623ba 100644 --- a/hydra/plugins/completion_plugin.py +++ b/hydra/plugins/completion_plugin.py @@ -240,7 +240,6 @@ def _query(self, config_name: Optional[str], line: str) -> List[str]: ) config_matches: List[str] = [] if not exact_match: - run_mode = RunMode.MULTIRUN if parsed_args.multirun else RunMode.RUN config_matches = [] try: diff --git a/hydra/test_utils/launcher_common_tests.py b/hydra/test_utils/launcher_common_tests.py index cb13cd988bc..af2346a489d 100644 --- a/hydra/test_utils/launcher_common_tests.py +++ b/hydra/test_utils/launcher_common_tests.py @@ -215,7 +215,6 @@ def test_sweep_with_custom_resolver( overrides: List[str], tmpdir: Path, ) -> None: - overrides1 = ["hydra/launcher=" + launcher_name] + overrides def task_func(c: DictConfig) -> Any: diff --git a/noxfile.py b/noxfile.py index 31267fc8289..2a19efc60b0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -206,7 +206,6 @@ def list_plugins(directory: str) -> List[Plugin]: plugins: List[Plugin] = [] for dir_name in _plugin_directories: - abspath = os.path.join(BASE, directory, dir_name) setup_py = os.path.join(abspath, "setup.py") name_and_classifiers: List[str] = subprocess.check_output( diff --git a/plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/config.py b/plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/config.py index 01c90e91a05..0aeff862f93 100644 --- a/plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/config.py +++ b/plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/config.py @@ -34,7 +34,6 @@ class ExperimentConfig: @dataclass class ClientConfig: - verbose_logging: bool = False # set random seed here to make Ax results reproducible @@ -43,7 +42,6 @@ class ClientConfig: @dataclass class AxConfig: - # max_trials is application-specific. Tune it for your use case max_trials: int = 10 early_stop: EarlyStopConfig = field(default_factory=EarlyStopConfig) 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 bb34581c383..70f9ba38a85 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 @@ -117,7 +117,6 @@ def setup( ) def sweep(self, arguments: List[str]) -> None: - assert self.config is not None assert self.launcher is not None assert self.job_idx is not None diff --git a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/config.py b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/config.py index 5709136d1bb..de3f1f08e86 100644 --- a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/config.py +++ b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/config.py @@ -35,7 +35,6 @@ class ScalarConfigSpec: @dataclass class OptimConf: - # name of the Nevergrad optimizer to use. Here is a sample: # - "OnePlusOne" extremely simple and robust, especially at low budget, but # tends to converge early. diff --git a/plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/config.py b/plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/config.py index 6769d4dec0e..03fde5a12d0 100644 --- a/plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/config.py +++ b/plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/config.py @@ -118,7 +118,6 @@ class MOTPESamplerConfig(SamplerConfig): @dataclass class DistributionConfig: - # Type of distribution. "int", "float" or "categorical" type: DistributionType diff --git a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py index 5ceec12090c..bcc0da62c8d 100644 --- a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py +++ b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py @@ -125,7 +125,6 @@ def launch_jobs( **launcher.create_update_cluster, ) with tempfile.TemporaryDirectory() as local_tmp_download_dir: - with ray_tmp_dir(config, launcher.ray_cfg.run_env.name) as remote_tmp_dir: sdk.rsync( config, diff --git a/plugins/hydra_ray_launcher/integration_test_tools/setup_integration_test_ami.py b/plugins/hydra_ray_launcher/integration_test_tools/setup_integration_test_ami.py index ca9dce70535..f114e67b424 100644 --- a/plugins/hydra_ray_launcher/integration_test_tools/setup_integration_test_ami.py +++ b/plugins/hydra_ray_launcher/integration_test_tools/setup_integration_test_ami.py @@ -22,7 +22,6 @@ def _run_command(command: str) -> str: def run(py_version): - _run_command("rm /home/ubuntu/ray_bootstrap_config.yaml") _run_command(f"conda create -n hydra_{py_version} python={py_version} -y") diff --git a/plugins/hydra_submitit_launcher/hydra_plugins/hydra_submitit_launcher/submitit_launcher.py b/plugins/hydra_submitit_launcher/hydra_plugins/hydra_submitit_launcher/submitit_launcher.py index 8aa8f6f60f3..1efc8e4ce86 100644 --- a/plugins/hydra_submitit_launcher/hydra_plugins/hydra_submitit_launcher/submitit_launcher.py +++ b/plugins/hydra_submitit_launcher/hydra_plugins/hydra_submitit_launcher/submitit_launcher.py @@ -16,7 +16,6 @@ class BaseSubmititLauncher(Launcher): - _EXECUTOR = "abstract" def __init__(self, **params: Any) -> None: diff --git a/tests/instantiate/test_instantiate.py b/tests/instantiate/test_instantiate.py index cde77d8af78..5e0654cecaf 100644 --- a/tests/instantiate/test_instantiate.py +++ b/tests/instantiate/test_instantiate.py @@ -691,7 +691,6 @@ def test_instantiate_bad_adam_conf(instantiate_func: Any, recwarn: Any) -> None: def test_instantiate_with_missing_module(instantiate_func: Any) -> None: - _target_ = "tests.instantiate.ClassWithMissingModule" with raises( InstantiationException, diff --git a/tests/test_env_defaults.py b/tests/test_env_defaults.py index c3b78680550..796bffc0b70 100644 --- a/tests/test_env_defaults.py +++ b/tests/test_env_defaults.py @@ -7,7 +7,6 @@ def test_env_defaults(tmpdir: Path) -> None: - cmd = [ "tests/test_apps/custom_env_defaults/my_app.py", "hydra.run.dir=" + str(tmpdir), diff --git a/tests/test_examples/test_tutorials_basic.py b/tests/test_examples/test_tutorials_basic.py index 33723ffb66d..941e3f9fd1d 100644 --- a/tests/test_examples/test_tutorials_basic.py +++ b/tests/test_examples/test_tutorials_basic.py @@ -312,7 +312,6 @@ def test_sweeping_example( def test_advanced_ad_hoc_composition( monkeypatch: Any, tmpdir: Path, args: List[str], expected: Any ) -> None: - monkeypatch.setenv("USER", "test_user") cmd = [ "examples/advanced/ad_hoc_composition/hydra_compose_example.py", diff --git a/tests/test_hydra.py b/tests/test_hydra.py index f4efad451fc..c75e3d39ba3 100644 --- a/tests/test_hydra.py +++ b/tests/test_hydra.py @@ -1824,7 +1824,6 @@ def test_hydra_mode( ] ) if error: - expected = normalize_newlines(expected_output) ret = run_with_error(cmd) assert_regex_match( @@ -1834,7 +1833,6 @@ def test_hydra_mode( to_name="Actual output", ) elif warning: - out, err = run_python_script(cmd, allow_warnings=True) assert_regex_match( from_line=expected_output, diff --git a/tools/configen/configen/config.py b/tools/configen/configen/config.py index 3ff6b00cfa0..39bd4691f76 100644 --- a/tools/configen/configen/config.py +++ b/tools/configen/configen/config.py @@ -22,7 +22,6 @@ class ModuleConf: @dataclass class ConfigenConf: - # output dir output_dir: str = MISSING diff --git a/tools/configen/configen/configen.py b/tools/configen/configen/configen.py index 438ea73635b..c553dad357b 100644 --- a/tools/configen/configen/configen.py +++ b/tools/configen/configen/configen.py @@ -89,7 +89,6 @@ class ClassInfo: def is_incompatible(type_: Type[Any]) -> bool: - opt = _resolve_optional(type_) # Unions are not supported (Except Optional) if not opt[0] and is_union_annotation(type_): @@ -131,7 +130,6 @@ def is_incompatible(type_: Type[Any]) -> bool: def get_default_flags(module: ModuleConf) -> List[Parameter]: - def_flags: List[Parameter] = [] if module.default_flags._convert_ is not None: