diff --git a/casanovo/config.py b/casanovo/config.py index 4992a882..c07073d6 100644 --- a/casanovo/config.py +++ b/casanovo/config.py @@ -88,16 +88,12 @@ def __init__(self, config_file: Optional[str] = None): keys_set = set(self._params.keys()) users_set = set(self._user_config.keys()) missing = list(keys_set - users_set) - raise KeyError( - f"Missing expected entry {missing}" - ) + raise KeyError(f"Missing expected entry {missing}") # detect unrecognized config file entries keys = list(self._params.keys()) - for key,val in self._user_config.items(): + for key, val in self._user_config.items(): if key not in keys: - raise KeyError( - f"Unrecognized config file entry {key}" - ) + raise KeyError(f"Unrecognized config file entry {key}") # Validate: for key, val in self._config_types.items(): self.validate_param(key, val) diff --git a/tests/conftest.py b/tests/conftest.py index bbf51838..02d5015d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -197,7 +197,7 @@ def tiny_config(tmp_path): "model_save_folder_path": str(tmp_path), "accelerator": "cpu", "precursor_mass_tol": 5, - "isotope_error_range": [0,1], + "isotope_error_range": [0, 1], "min_peptide_len": 6, "predict_batch_size": 1024, "n_beams": 1, @@ -252,8 +252,8 @@ def tiny_config(tmp_path): "+42.011": 42.010565, "+43.006": 43.005814, "-17.027": -17.026549, - "+43.006-17.027": 25.980265 - } + "+43.006-17.027": 25.980265, + }, } cfg_file = tmp_path / "config.yml" diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py index ce695f93..4d1bb17f 100644 --- a/tests/unit_tests/test_config.py +++ b/tests/unit_tests/test_config.py @@ -28,16 +28,14 @@ def test_override(tmp_path, tiny_config): """ ) - with open (tiny_config, 'r') as read_file: + with open(tiny_config, "r") as read_file: contents = yaml.safe_load(read_file) - contents['random_seed_'] = 354 - print(contents) + contents["random_seed_"] = 354 - with open('output.yml', 'w') as write_file: + with open("output.yml", "w") as write_file: yaml.safe_dump(contents, write_file) with pytest.raises(KeyError): - config = Config('output.yml') + config = Config("output.yml") with pytest.raises(KeyError): - config = Config(yml) - \ No newline at end of file + config = Config(yml) \ No newline at end of file