Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ultmaster committed Sep 18, 2023
1 parent bb2b130 commit 52ad5aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
7 changes: 5 additions & 2 deletions coml/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import click
from typing import Optional

import click

from .orm import database_proxy


Expand All @@ -25,12 +26,14 @@ def main(
if ctx.params["space"] is None or ctx.params["task"] is None:
print("Please specify space ID and a task description.")
return
from .suggest import suggest, print_suggested_configs
from .space import import_space
from .suggest import print_suggested_configs, suggest

results = suggest(import_space(ctx.params["space"]), ctx.params["task"])
print_suggested_configs(*results)
database_proxy.close()


@main.command()
@click.argument("space", nargs=1)
@click.argument("history", nargs=1)
Expand Down
8 changes: 2 additions & 6 deletions coml/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def cosine_distance(self, text: str):
password=COML_DB_PASSWORD,
)
else:
raise NotImplementedError(
f"COML_DB_BACKEND {COML_DB_BACKEND} not supported."
)
raise NotImplementedError(f"COML_DB_BACKEND {COML_DB_BACKEND} not supported.")


def init_db():
Expand Down Expand Up @@ -128,9 +126,7 @@ class Space(BaseModel):

class Task(BaseModel):
task_id: str = TextField(primary_key=True)
embedding = (
ArrayField() if COML_DB_BACKEND == "sqlite" else VectorField(EMBED_DIM)
)
embedding = ArrayField() if COML_DB_BACKEND == "sqlite" else VectorField(EMBED_DIM)
desc = TextField()
row_desc = TextField()

Expand Down
5 changes: 1 addition & 4 deletions coml/suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
)


def print_suggested_configs(
configurations: Any,
knowledge: str | None
) -> None:
def print_suggested_configs(configurations: Any, knowledge: str | None) -> None:
if knowledge:
print(f"\n* Rationale: ")
print(knowledge)
Expand Down
6 changes: 1 addition & 5 deletions test/test_surrogate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import pandas as pd
import pytest

from coml.surrogate_utils import (
evaluate_configs,
process_history_df,
train_surrogate,
)
from coml.surrogate_utils import evaluate_configs, process_history_df, train_surrogate


def test_process_history_df():
Expand Down

0 comments on commit 52ad5aa

Please sign in to comment.