Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Bugbear rules #14

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fixable = ["ALL"]

# Select or ignore from https://beta.ruff.rs/docs/rules/
select = [
# "B", # bugbear
"B", # bugbear
# "D", # pydocstyle
# "E", # pycodestyle errors
"F", # Pyflakes
Expand Down
2 changes: 1 addition & 1 deletion src/curate_gpt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def ask(query, path, collection, model, show_references, _continue, conversation
conversation = load_conversation(conversation_id)
print(f"CONTINUING CONVERSATION {conversation}")
except UnknownModelError as ex:
raise click.ClickException(str(ex))
raise click.ClickException(str(ex)) from ex
chatbot = ChatAgent(path)
chatbot.extractor = extractor
chatbot.knowledge_source = db
Expand Down
2 changes: 1 addition & 1 deletion src/curate_gpt/utils/vectordb_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def match_collections(
tm_ix, tm_vals = top_matches(sim_matrix)
logger.info(f"Yielding {len(tm_ix)} matches")
i = 0
for ix, val in zip(tm_ix, tm_vals):
for ix, val in zip(tm_ix, tm_vals, strict=True):
yield left_objs[i][0], right_objs[ix][0], val
i += 1
6 changes: 4 additions & 2 deletions src/llm_gpt4all.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ def fetch_cached_json(url, path, cache_timeout):
json.dump(response.json(), file)

return response.json()
except (httpx.HTTPError, urllib3.exceptions.NameResolutionError):
except (httpx.HTTPError, urllib3.exceptions.NameResolutionError) as ex:
# If there's an existing file, load it
if path.is_file():
with open(path, "r") as file:
return json.load(file)
else:
# If not, raise an error
raise DownloadError(f"Failed to download data and no cache is available at {path}")
raise DownloadError(
f"Failed to download data and no cache is available at {path}. Error: {ex}"
) from ex


def human_readable_size(size_bytes):
Expand Down
Loading