-
Notifications
You must be signed in to change notification settings - Fork 525
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: replace reduciable
with reducible
#3888
Conversation
Fix the spelling as suggested by deepmodeling#3867 (comment). Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
WalkthroughWalkthroughThis update corrects a typo across multiple files in the Changes
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (29)
Files skipped from review due to trivial changes (9)
Additional context usedRuff
Additional comments not posted (32)
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 (
|
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: 0
Outside diff range and nitpick comments (26)
deepmd/pt/model/task/dos.py (2)
Line range hint
48-48
: Avoid mutable default arguments as they can lead to unexpected behaviors.- neuron: List[int] = [128, 128, 128], + neuron: Optional[List[int]] = None,And in the constructor, add:
if neuron is None: neuron = [128, 128, 128]
Line range hint
58-58
: Avoid mutable default arguments for the same reasons as above.- exclude_types: List[int] = [], + exclude_types: Optional[List[int]] = None,And in the constructor, add:
if exclude_types is None: exclude_types = []deepmd/pt/model/task/denoise.py (1)
Line range hint
32-32
: Avoid mutable default arguments as they can lead to unexpected behaviors.- prefactor=[0.5, 0.5], + prefactor: Optional[List[float]] = None,And in the constructor, add:
if prefactor is None: prefactor = [0.5, 0.5]deepmd/pt/model/task/invar_fitting.py (1)
Line range hint
89-89
: Avoid mutable default arguments as they can lead to unexpected behaviors.- neuron: List[int] = [128, 128, 128], + neuron: Optional[List[int]] = None,And in the constructor, add:
if neuron is None: neuron = [128, 128, 128]Also applies to: 99-99
deepmd/pt/model/task/dipole.py (1)
Line range hint
82-82
: Avoid using mutable default arguments for function parameters.- neuron: List[int] = [128, 128, 128], - exclude_types: List[int] = [], + neuron: Optional[List[int]] = None, + exclude_types: Optional[List[int]] = None,Initialize these in the function body to ensure they are created fresh on each function call. This prevents potential bugs related to mutable defaults being shared across multiple calls.
Also applies to: 91-91
source/tests/pt/model/test_linear_atomic_model_stat.py (1)
Line range hint
179-179
: Remove assignment to unused variablef
.- with h5py.File(h5file, "w") as f: + with h5py.File(h5file, "w"):This change removes the unused variable, adhering to clean code practices and preventing potential confusion about its purpose.
deepmd/dpmodel/fitting/dipole_fitting.py (1)
Line range hint
92-92
: Avoid using mutable default arguments for function parameters.- neuron: List[int] = [120, 120, 120], - exclude_types: List[int] = [], + neuron: Optional[List[int]] = None, + exclude_types: Optional[List[int]] = None,Initialize these in the function body to ensure they are created fresh on each function call. This prevents potential bugs related to mutable defaults being shared across multiple calls.
Also applies to: 105-105
deepmd/pt/model/task/ener.py (1)
Line range hint
50-50
: Avoid using mutable default arguments in function definitions.- neuron: List[int] = [128, 128, 128], + neuron: Optional[List[int]] = None,And then initialize within the function:
if neuron is None: neuron = [128, 128, 128]deepmd/dpmodel/fitting/invar_fitting.py (1)
Line range hint
120-120
: Avoid using mutable default arguments in function definitions.- neuron: List[int] = [120, 120, 120], + neuron: Optional[List[int]] = None,And then initialize within the function:
if neuron is None: neuron = [120, 120, 120]Also applies to: 135-135
deepmd/pt/model/task/polarizability.py (1)
Line range hint
86-86
: Avoid using mutable default arguments in function definitions.- neuron: List[int] = [128, 128, 128], + neuron: Optional[List[int]] = None,And then initialize within the function:
if neuron is None: neuron = [128, 128, 128]Also applies to: 95-95
deepmd/dpmodel/atomic_model/base_atomic_model.py (2)
Line range hint
40-40
: Avoid using mutable default arguments in function definitions.- atom_exclude_types: List[int] = [], - pair_exclude_types: List[Tuple[int, int]] = [], + atom_exclude_types: Optional[List[int]] = None, + pair_exclude_types: Optional[List[Tuple[int, int]]] = None,And then initialize within the function:
if atom_exclude_types is None: atom_exclude_types = [] if pair_exclude_types is None: pair_exclude_types = []Also applies to: 41-41, 87-87, 97-97
Line range hint
201-201
: Usekey in dict
instead ofkey in dict.keys()
.- if key in self.bias_keys.keys(): + if key in self.bias_keys:Also applies to: 247-247
deepmd/dpmodel/fitting/polarizability_fitting.py (1)
Line range hint
97-97
: Replace mutable default arguments with immutable defaults in the constructor.- neuron: List[int] = [120, 120, 120], + neuron: Optional[List[int]] = None, - trainable: Optional[List[bool]] = None, + trainable: Optional[List[bool]] = None,Initialize these within the function if they are
None
.Also applies to: 110-110
source/tests/pt/model/test_atomic_model_atomic_stat.py (1)
Line range hint
171-171
: Remove assignment to unused variablef
in the test cases.- with h5py.File(h5file, "w") as f: + with h5py.File(h5file, "w"):Also applies to: 341-341
source/tests/pt/model/test_atomic_model_global_stat.py (2)
Line range hint
173-173
: Remove the unused variable to clean up the code.- f = ...
Line range hint
490-490
: Remove the unused variable to enhance code cleanliness.- at = ...
deepmd/pt/model/atomic_model/base_atomic_model.py (7)
Line range hint
80-80
: Replace mutable default arguments withNone
to avoid potential bugs.- atom_exclude_types: List[int] = [], + atom_exclude_types: Optional[List[int]] = None,
Line range hint
81-81
: Replace mutable default arguments withNone
to avoid potential bugs.- pair_exclude_types: List[Tuple[int, int]] = [], + pair_exclude_types: Optional[List[Tuple[int, int]]] = None,
Line range hint
129-129
: Replace mutable default arguments withNone
to avoid potential bugs.- exclude_types: List[int] = [], + exclude_types: Optional[List[int]] = None,
Line range hint
139-139
: Replace mutable default arguments withNone
to avoid potential bugs.- exclude_types: List[Tuple[int, int]] = [], + exclude_types: Optional[List[Tuple[int, int]]] = None,
Line range hint
254-254
: Simplify dictionary key checking by removing.keys()
.- if kk in self.bias_keys.keys(): + if kk in self.bias_keys:
Line range hint
542-542
: Simplify dictionary key checking by removing.keys()
.- if kk in out_bias.keys(): + if kk in out_bias:
Line range hint
543-543
: Simplify dictionary key checking by removing.keys()
.- if kk in out_std.keys(): + if kk in out_std:source/tests/common/dpmodel/test_output_def.py (3)
Line range hint
608-608
: Replace mutable default arguments withNone
to avoid potential bugs.- shape_rd=[nf, 1], - shape_dr=[nf, nall, 1, 3], + shape_rd=None, + shape_dr=None,Initialize
shape_rd
andshape_dr
within the constructor if they areNone
.Also applies to: 609-609, 693-693
Line range hint
482-482
: Remove unused variablecontext
in exception handling.- with self.assertRaises(ValueError) as context: + with self.assertRaises(ValueError):Also applies to: 492-492, 496-496, 509-509, 522-522
Line range hint
661-661
: Remove unused variablenall
.- nall = 4
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #3888 +/- ##
==========================================
+ Coverage 82.71% 82.74% +0.02%
==========================================
Files 517 518 +1
Lines 50139 50215 +76
Branches 2984 2984
==========================================
+ Hits 41472 41548 +76
Misses 7757 7757
Partials 910 910 ☔ View full report in Codecov by Sentry. |
Fix the spelling as suggested by deepmodeling#3867 (comment). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Corrected typos in attribute names from `reduciable` to `reducible` across multiple files, enhancing the accuracy of parameter definitions and improving code consistency. - **Tests** - Updated test cases to reflect the corrected attribute names, ensuring that tests accurately validate the new `reducible` parameter. These changes improve the clarity and correctness of the codebase, ensuring that attribute names are consistent and accurately reflect their intended functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Fix the spelling as suggested by #3867 (comment).
Summary by CodeRabbit
Bug Fixes
reduciable
toreducible
across multiple files, enhancing the accuracy of parameter definitions and improving code consistency.Tests
reducible
parameter.These changes improve the clarity and correctness of the codebase, ensuring that attribute names are consistent and accurately reflect their intended functionality.