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

fix: removed dataegap and test searchby keyword #56

Merged
merged 2 commits into from
Feb 8, 2025
Merged

Conversation

selvaebi
Copy link
Contributor

@selvaebi selvaebi commented Feb 7, 2025

Summary by CodeRabbit

  • Refactor
    • Streamlined project search by removing the date filtering option, simplifying the search process.
  • Chores
    • Improved file download performance by increasing the default bandwidth limit from 50M to 100M.
  • Tests
    • Enhanced search functionality tests to ensure at least one matching result is returned.

@selvaebi selvaebi requested a review from ypriverol February 7, 2025 19:44
Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

The pull request removes the date_gap parameter from both the search_projects_by_keywords_and_filters function in pridepy.py and the search_by_keywords_and_filters method in the Project class, simplifying their interfaces and URL construction. Additionally, it updates the default value for the aspera_maximum_bandwidth parameter from "50M" to "100M" in the file download functions. A new test case in the test suite verifies that the search functionality returns at least one matching project. Overall, the changes streamline function signatures and adjust default network settings.

Changes

File(s) Change Summary
pridepy/pridepy.py,
pridepy/project/project.py
Removed the date_gap parameter from search functions and associated logic; updated aspera_maximum_bandwidth default value from "50M" to "100M".
pridepy/tests/test_search.py Updated the test to verify that the search function returns at least one matching project instead of checking for an exact count.

Possibly related PRs

  • Dev #53: The changes in the main PR are directly related to the modifications made to the search_projects_by_keywords_and_filters function and the search_by_keywords_and_filters method, as both involve the removal of the date_gap parameter from their signatures.

Poem

Hoppity, hoppity, I code with delight,
Removing old parameters out of sight.
The date_gap is gone, the interface is neat,
"100M" now speeds up every download beat.
I, a rabbit of code, cheer calm and bright—
Let's hop through changes into the moonlight!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
pridepy/pridepy.py (2)

238-239: Fix the mismatch between function signature and implementation.

The date_gap parameter is present in the function signature but not used in the implementation.

Apply this diff to fix the signature:

-def search_projects_by_keywords_and_filters(
-    keyword, filter, page_size, page, date_gap, sort_direction, sort_fields
-):
+def search_projects_by_keywords_and_filters(
+    keyword, filter, page_size, page, sort_direction, sort_fields
+):

Also applies to: 246-248


56-57: Fix inconsistency in default bandwidth values.

The default bandwidth value in the function signatures (50M) doesn't match the @click.option default value and help text (100M).

Apply this diff to fix the inconsistency:

-    aspera_maximum_bandwidth: str = "50M",
+    aspera_maximum_bandwidth: str = "100M",

Also applies to: 132-133

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0209080 and ad6faf1.

📒 Files selected for processing (3)
  • pridepy/pridepy.py (1 hunks)
  • pridepy/project/project.py (0 hunks)
  • pridepy/tests/test_search.py (1 hunks)
💤 Files with no reviewable changes (1)
  • pridepy/project/project.py
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
pridepy/tests/test_search.py (1)

23-26: ⚠️ Potential issue

Fix syntax errors and approve test improvements.

The test logic improvements make the test more robust and maintainable. However, there are syntax errors in the assertions that need to be fixed.

-        assert len(result) == 2
-        # Verify that search returns at least one result and contains the expected project
-        assert len(result) > 0, "Search should return at least one result"
-        assert any(r["accession"] == "PXD009476" for r in result), "Search should return the queried project"
+        # Verify that search returns at least one result and contains the expected project
+        self.assertGreater(len(result), 0, "Search should return at least one result")
+        self.assertTrue(
+            any(r["accession"] == "PXD009476" for r in result),
+            "Search should return the queried project"
+        )
🧰 Tools
🪛 Ruff (0.8.2)

23-23: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


23-23: SyntaxError: Simple statements must be separated by newlines or semicolons


24-25: SyntaxError: Expected an expression


25-25: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


25-25: SyntaxError: Simple statements must be separated by newlines or semicolons


26-26: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


26-26: SyntaxError: Simple statements must be separated by newlines or semicolons

🪛 GitHub Actions: Python application

[error] 23-23: SyntaxError: invalid syntax

🪛 GitHub Actions: Python package

[error] 23-23: SyntaxError: invalid syntax

🧹 Nitpick comments (1)
pridepy/tests/test_search.py (1)

20-22: Fix formatting for better readability.

The method call parameters could be formatted more consistently:

-        result = project.search_by_keywords_and_filters(keyword="PXD009476",query_filter="",
-                                                        page_size=100,page=0 , sort_direction="DESC",
-                                                        sort_fields="accession")
+        result = project.search_by_keywords_and_filters(
+            keyword="PXD009476",
+            query_filter="",
+            page_size=100,
+            page=0,
+            sort_direction="DESC",
+            sort_fields="accession"
+        )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad6faf1 and 3c156d2.

📒 Files selected for processing (1)
  • pridepy/tests/test_search.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
pridepy/tests/test_search.py

23-23: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


23-23: SyntaxError: Simple statements must be separated by newlines or semicolons


24-25: SyntaxError: Expected an expression


25-25: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


25-25: SyntaxError: Simple statements must be separated by newlines or semicolons


26-26: SyntaxError: Expected an identifier, but found a keyword 'assert' that cannot be used here


26-26: SyntaxError: Simple statements must be separated by newlines or semicolons

🪛 GitHub Actions: Python application
pridepy/tests/test_search.py

[error] 23-23: SyntaxError: invalid syntax

🪛 GitHub Actions: Python package
pridepy/tests/test_search.py

[error] 23-23: SyntaxError: invalid syntax

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

@ypriverol ypriverol merged commit fd41a6a into master Feb 8, 2025
5 of 8 checks passed
@ypriverol ypriverol deleted the refactor branch February 8, 2025 13:52
@coderabbitai coderabbitai bot mentioned this pull request Feb 9, 2025
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.

3 participants