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

chore: 📦 Update dependencies in poetry.lock and pyproject.toml #1642

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

Anselmoo
Copy link
Owner

@Anselmoo Anselmoo commented Oct 14, 2024

All PR-Submissions:


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open
    Pull Requests for the same
    update/change?

New ✨✨ Feature-Submissions:


  • Does your submission pass tests?
  • Have you lint your code locally prior to submission? Fixed:
  • This PR is for a new feature, not a bug fix.

Changes to ⚙️ Core-Features:


  • Have you added an explanation of what your changes do and why you'd like
    us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Summary by Sourcery

Enhancements:

  • Update type annotations in test fixtures to use np.float64 instead of Shape annotations for better clarity and consistency.

@Anselmoo Anselmoo enabled auto-merge (squash) October 14, 2024 04:53
Copy link

semanticdiff-com bot commented Oct 14, 2024

Review changes with SemanticDiff.

Analyzed 1 of 3 files.

Overall, the semantic diff is 50% smaller than the GitHub diff.

Filename Status
poetry.lock Unsupported file format
pyproject.toml Unsupported file format
✔️ spectrafit/plugins/test/test_converter.py 49.98% smaller

Copy link
Contributor

sourcery-ai bot commented Oct 14, 2024

Reviewer's Guide by Sourcery

This pull request updates type annotations in the test_converter.py file, specifically changing the type hints for NumPy arrays. The changes focus on improving type specificity and compatibility with newer typing conventions.

Updated class diagram for test_converter.py type annotations

classDiagram
    class TestConverter {
        - tmp_file_dict: Dict[str, Dict[str, NDArray[Shape["200"], Float]]]
        + tmp_file_dict: Dict[str, Dict[str, NDArray[Any]]]
        - tmp_file_dict: Dict[str, Dict[str, NDArray[Shape["200"], Float]]]
        + tmp_file_dict: Dict[str, Dict[str, NDArray[np.float64]]]
    }
    note for TestConverter "Type annotations updated for better specificity and compatibility with newer typing conventions."
Loading

File-Level Changes

Change Details Files
Update type annotations for NumPy arrays in test fixtures and methods
  • Replace NDArray[Shape['200'], Float] with NDArray[Any] or NDArray[np.float64]
  • Update function signatures in pytest fixtures
  • Modify type hints in test method parameters
spectrafit/plugins/test/test_converter.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

phylum-io bot commented Oct 14, 2024

Phylum OSS Supply Chain Risk Analysis - INCOMPLETE

The analysis contains 1 package(s) Phylum has not yet processed,
preventing a complete risk analysis. Phylum is processing these
packages currently and should complete soon.
Please wait for up to 30 minutes, then re-run the analysis.

View this project in the Phylum UI

@github-actions github-actions bot added testing Improve testing & coverage maintenance Maintenance & Security dependencies Pull requests that update a dependency file python Pull requests that update Python code root labels Oct 14, 2024
Copy link

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Anselmoo - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The PR title and description mention updating dependencies, but the actual changes appear to be related to type annotations in test files. Please update the PR title and description to accurately reflect the changes made.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -403,7 +401,7 @@ def test_cmd_data_converter_nor_to_csv(


Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (testing): Consider adding a test for the new, more flexible type annotation

The change from NDArray[Shape["200"], Float] to NDArray[Any] allows for more flexibility in the array shape and type. It would be beneficial to add a test case that uses an array with a different shape or type to ensure this change doesn't introduce any unexpected behavior.

@pytest.fixture(scope="function", autouse=True, name="tmp_file_dict")
def tmp_file_dict() -> Dict[str, Dict[str, NDArray[Any]]]:
    """Create temporary file with pickle data."""
    return {
        "test_data": {
            "array_1d": np.random.rand(200),
            "array_2d": np.random.rand(10, 20),
            "array_3d": np.random.rand(5, 5, 5),
        }
    }

@@ -444,7 +442,7 @@ def tmp_file_nested_dict() -> Dict[str, Dict[str, Any]]:

@pytest.fixture(scope="function", autouse=True, name="tmp_pkl_gz_file")
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (testing): Update test cases to cover new type annotation

The type annotation has changed from NDArray[Shape["200"], Float] to NDArray[np.float64]. Ensure that the existing test cases still cover all scenarios, and consider adding new test cases that specifically test the behavior with np.float64 arrays of various shapes.

    tmp_path: Path, tmp_file_dict: Dict[str, Dict[str, NDArray[np.float64]]], 
    test_shapes: List[Tuple[int, ...]] = [(200,), (100, 2), (50, 2, 2)]
) -> Path:
    """Create temporary file with pickle data for various array shapes."""
    for shape in test_shapes:
        tmp_file_dict[f"test_array_{shape}"] = {
            "data": np.random.rand(*shape).astype(np.float64)
        }

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1d67899) to head (ec12208).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1642   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           45        45           
  Lines         4518      4516    -2     
=========================================
- Hits          4518      4516    -2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spectrafit/plugins/test/test_converter.py 100.00% <100.00%> (ø)

@Anselmoo Anselmoo merged commit 3a20d59 into main Oct 14, 2024
33 checks passed
@Anselmoo Anselmoo deleted the remove-nptyping branch October 14, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file maintenance Maintenance & Security python Pull requests that update Python code root size/S testing Improve testing & coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant