-
Notifications
You must be signed in to change notification settings - Fork 3
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: allow repeat with dtype=dict #67
Conversation
Signed-off-by: Jinzhe Zeng <[email protected]>
Warning Rate limit exceeded@njzjz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 40 minutes and 20 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes enhance the handling of data types in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@iProzd please help to see if this is useful to |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #67 +/- ##
==========================================
+ Coverage 83.76% 84.15% +0.39%
==========================================
Files 5 5
Lines 690 707 +17
==========================================
+ Hits 578 595 +17
Misses 112 112 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (3)
dargs/sphinx.py (1)
Line range hint
61-63
: Improve exception handling by linking the cause of the exception.- raise self.error(f'Failed to import "{attr_name}" from "{module_name}".\n{sys.exc_info()[1]}') + raise self.error(f'Failed to import "{attr_name}" from "{module_name}".\n{sys.exc_info()[1]}') from Nonedargs/dargs.py (2)
112-112
: Update the comment to reflect the new functionality more clearly.Consider enhancing the clarity of the comment by specifying what "sub fields and sub variants" entails, especially since
dtype
can now also be a dictionary of dictionaries.
Line range hint
360-383
: Refactor the traversal logic to simplify and enhance readability.The traversal logic for handling
value
based onrepeat
and its type (list or dict) can be refactored for better readability and maintainability. Consider using a helper method to handle the common logic.- if not self.repeat and isinstance(value, dict): - self._traverse_sub( - value, key_hook, value_hook, sub_hook, variant_hook, path - ) - elif self.repeat and isinstance(value, list): - for idx, item in enumerate(value): - self._traverse_sub( - item, - key_hook, - value_hook, - sub_hook, - variant_hook, - [*path, str(idx)], - ) - elif self.repeat and isinstance(value, dict): - for kk, item in value.items(): - self._traverse_sub( - item, - key_hook, - value_hook, - sub_hook, - variant_hook, - [*path, kk], - ) + self._handle_traversal(value, key_hook, value_hook, sub_hook, variant_hook, path)Consider implementing a
_handle_traversal
method that encapsulates the common logic and simplifies the maintraverse_value
method.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Jinzhe Zeng <[email protected]>
This will be helpful to normalize
model_dict
,loss_dict
, etc, in DeePMD-kit.Summary by CodeRabbit
New Features
repeat
flag, supporting both lists of dicts and dicts of dicts.Bug Fixes
repeat
flag.Tests