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

Speedups #54

Merged
merged 2 commits into from
Jun 21, 2024
Merged

Speedups #54

merged 2 commits into from
Jun 21, 2024

Conversation

granawkins
Copy link
Member

No description provided.

Copy link

@mentatai mentatai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request introduces several improvements and refactoring in the hierarchy annotator and updates the version number. The changes are well-aligned with the project's structure and should enhance the maintainability of the code. Overall, the modifications are beneficial and appear to be correctly implemented.

Butler is in closed beta. Reply with feedback or to ask Butler to review other parts of the PR. Please give feedback with emoji reacts.

@@ -7,7 +7,7 @@ packages=["ragdaemon"]

[project]
name = "ragdaemon"
version = "0.7.7"
version = "0.7.8"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version number has been updated from 0.7.7 to 0.7.8. Please ensure that all related documentation and dependency requirements are also updated accordingly if needed.

@@ -1 +1 @@
__version__ = "0.7.7"
__version__ = "0.7.8"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version number in __init__.py has been updated to match the new version in pyproject.toml. This is good for maintaining consistency across the project.

@@ -66,37 +66,32 @@ async def annotate(
for parent in path.parents:
if len(parent.parts) == 0:
parent = Path("ROOT")
directories.add(parent)
directories.add(parent.as_posix())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion of parent to parent.as_posix() directly in the directories set is a good change for consistency, ensuring that all directory paths are stored in the same string format.

)
for source, target in edges:
for id in (source, target):
if id not in graph and id not in directories:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for id not being in graph or directories before adding an edge is crucial for data integrity. This prevents the graph from having edges that reference non-existent nodes.

Comment on lines +79 to +80
# Fill-in directory data (same process as get_document for dirs, but more efficient)
for dir in sorted(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Fill-in directory data (same process as get_document for dirs, but more efficient)
for dir in sorted(
for dir in sorted(directories, key=lambda x: len(x) if x != 'ROOT' else 0, reverse=True):

Refactoring the sorting of directories to a more concise and readable format improves code maintainability. This change also ensures that 'ROOT' is properly handled as a special case.

@granawkins granawkins merged commit 5bc1bbc into main Jun 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant