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

Added batch decorator #47

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Added batch decorator #47

merged 1 commit into from
Dec 24, 2024

Conversation

ternaus
Copy link
Contributor

@ternaus ternaus commented Dec 24, 2024

Summary by Sourcery

Update ruff to v0.0.255 and mypy to v1.1.1. Stop ignoring the number of images in reshape_* functions.

Copy link
Contributor

sourcery-ai bot commented Dec 24, 2024

Reviewer's Guide by Sourcery

This pull request introduces a batch decorator and updates the dependencies.

Sequence diagram for batch data reshaping process

sequenceDiagram
    participant Input as Input Array
    participant Reshape as Reshape Function
    participant Transform as Spatial Transform
    participant Restore as Restore Function
    participant Output as Output Array

    Input->>Reshape: Send N-dimensional array
    Note over Reshape: reshape_batch() or reshape_3d()
    Reshape->>Transform: Reshaped array (H,W,...)
    Transform->>Restore: Transformed array
    Note over Restore: restore_batch() or restore_3d()
    Restore->>Output: Restored to original dimensions
Loading

Class diagram for array reshaping functions

classDiagram
    class ArrayReshaper {
        +reshape_3d(data: ndarray) tuple[ndarray, tuple]
        +reshape_batch(data: ndarray) tuple[ndarray, tuple]
        +reshape_batch_3d(data: ndarray) tuple[ndarray, tuple]
        +reshape_batch_3d_keep_depth(data: ndarray) tuple[ndarray, tuple]
        +reshape_batch_channel(data: ndarray) tuple[ndarray, tuple]
        +reshape_batch_3d_channel(data: ndarray) tuple[ndarray, tuple]
    }

    class ArrayRestorer {
        +restore_3d(data: ndarray, original_shape: tuple) ndarray
        +restore_batch(data: ndarray, original_shape: tuple) ndarray
        +restore_batch_3d(data: ndarray, original_shape: tuple) ndarray
    }

    note for ArrayReshaper "Handles various reshape operations for different array dimensions"
    note for ArrayRestorer "Restores arrays back to their original shapes"
Loading

File-Level Changes

Change Details Files
Unused variables are removed.
  • Removed unused variables num_images, depth, height, width, channels across multiple functions in decorators.py to improve code clarity and efficiency.
albucore/decorators.py
Dependency versions are updated.
  • Updated ruff from v0.8.3 to v0.8.4.
  • Updated mypy from v1.13.0 to v1.14.0.
.pre-commit-config.yaml

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

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@8cf9f9e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
albucore/decorators.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage        ?   62.21%           
=======================================
  Files           ?       21           
  Lines           ?     2554           
  Branches        ?        0           
=======================================
  Hits            ?     1589           
  Misses          ?      965           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 @ternaus - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 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.

@ternaus ternaus merged commit 2be441f into main Dec 24, 2024
16 checks passed
@ternaus ternaus deleted the add_batch_decorator branch December 24, 2024 20:25
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.

2 participants