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

[feat] Add new decorator assign_units for unit processing on input and output for a function that does not support unit operations #73

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

Routhleck
Copy link
Collaborator

This pull request introduces a new decorator function assign_units in the brainunit module to handle unit transformations for function arguments and return values. It also includes tests for this new functionality. The most important changes include adding the assign_units function, updating the _base.py file to include the new decorator, and adding corresponding tests.

New functionality for unit transformation:

  • Added assign_units decorator function to transform units of arguments passed to a function. (brainunit/_base.py)

Codebase updates:

  • Included assign_units in the list of functions for checking units. (brainunit/_base.py)
  • Added _assign_unit helper function to handle unit assignment within the assign_units decorator. (brainunit/_base.py)

Testing:

  • Added test_assign_units method to test various scenarios for the assign_units decorator, ensuring it correctly handles unit transformations and raises appropriate errors. (brainunit/_base_test.py)

@Routhleck
Copy link
Collaborator Author

#72

Copy link
Collaborator

@chaoming0625 chaoming0625 left a comment

Choose a reason for hiding this comment

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

Great.

@chaoming0625 chaoming0625 merged commit a840d6c into main Dec 4, 2024
24 checks passed
@chaoming0625 chaoming0625 deleted the assign-units branch December 4, 2024 08:27
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