Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 25, 2024
1 parent 4d57c31 commit d5d4502
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions packages/jupyter-ai/jupyter_ai/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ def _init_config(self):
def _process_existing_config(self, default_config):
with open(self.config_path, encoding="utf-8") as f:
existing_config = json.loads(f.read())
merged_config = Merger.merge(default_config,
{k: v for k, v in existing_config.items() if v is not None})
merged_config = Merger.merge(
default_config,
{k: v for k, v in existing_config.items() if v is not None},
)
config = GlobalConfig(**merged_config)
validated_config = self._validate_lm_em_id(config)

Expand Down
11 changes: 7 additions & 4 deletions packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def cm_with_allowlists(common_cm_kwargs):
}
return ConfigManager(**kwargs)


@pytest.fixture
def cm_with_defaults(cm_kargs_with_defaults):
"""The default ConfigManager instance, with an empty config and config schema."""
Expand Down Expand Up @@ -219,7 +220,11 @@ def test_init_with_allowlists(cm: ConfigManager, common_cm_kwargs):


def test_init_with_default_values(
cm_with_defaults: ConfigManager, config_path: str, schema_path: str, common_cm_kwargs):
cm_with_defaults: ConfigManager,
config_path: str,
schema_path: str,
common_cm_kwargs,
):
"""
Test that the ConfigManager initializes with the expected default values.
Expand Down Expand Up @@ -249,9 +254,7 @@ def test_init_with_default_values(
em_providers = get_em_providers()
kwargs = {
**common_cm_kwargs,
"defaults" : {
"model_provider_id": "bedrock-chat:anthropic.claude-v2"
},
"defaults": {"model_provider_id": "bedrock-chat:anthropic.claude-v2"},
}
cm_with_defaults_override = ConfigManager(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/jupyter_ai/workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"path": "../../.."
}
]
}
}

0 comments on commit d5d4502

Please sign in to comment.