Fix/remove deprecated methods from examples#312
Conversation
WalkthroughThis update to version 1.4.1 focuses on modernizing the codebase by replacing deprecated functions with their updated counterparts across example scripts and test files. It also updates the project version in its configuration, reflecting the continuous effort to align with best practices and maintain code quality. Changes
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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #312 +/- ##
==========================================
+ Coverage 76.16% 76.25% +0.09%
==========================================
Files 50 50
Lines 4111 4111
Branches 351 351
==========================================
+ Hits 3131 3135 +4
+ Misses 875 871 -4
Partials 105 105 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Review Status
Actionable comments generated: 11
Configuration used: .coderabbit.yaml
Files selected for processing (9)
- CHANGELOG.md (1 hunks)
- examples/chain_client/3_MessageBroadcaster.py (1 hunks)
- examples/chain_client/5_MessageBroadcasterWithoutSimulation.py (1 hunks)
- examples/chain_client/exchange/8_MsgCancelSpotOrder.py (1 hunks)
- examples/chain_client/exchange/9_MsgBatchUpdateOrders.py (1 hunks)
- pyproject.toml (1 hunks)
- tests/core/test_gas_limit_estimator.py (10 hunks)
- tests/test_async_client_deprecation_warnings.py (1 hunks)
- tests/test_composer_deprecation_warnings.py (2 hunks)
Files skipped from review due to trivial changes (2)
- pyproject.toml
- tests/test_async_client_deprecation_warnings.py
Additional comments: 6
examples/chain_client/3_MessageBroadcaster.py (1)
- 59-59: The update from
composer.MsgBatchUpdateOrderstocomposer.msg_batch_update_ordersaligns with the PR's objective to remove references to deprecated methods. This change is correctly applied and follows Python's naming conventions for methods. Ensure that all references to the old method name are updated across the project to maintain consistency.examples/chain_client/5_MessageBroadcasterWithoutSimulation.py (1)
- 59-59: The method call update from
composer.MsgBatchUpdateOrderstocomposer.msg_batch_update_ordersis correctly implemented, ensuring the example script uses the latest method names. This change is consistent with the PR's goal of updating example scripts to reflect current best practices. Good job on maintaining consistency across similar scripts.examples/chain_client/exchange/8_MsgCancelSpotOrder.py (1)
- 38-38: The update from
composer.MsgCancelSpotOrdertocomposer.msg_cancel_spot_orderis correctly applied, reflecting the PR's objective to use updated method names. This change ensures that the example script remains relevant and uses the current API. It's important to verify that all documentation and other example scripts are also updated to prevent confusion.examples/chain_client/exchange/9_MsgBatchUpdateOrders.py (1)
- 121-121: The method call update from
composer.MsgBatchUpdateOrderstocomposer.msg_batch_update_ordersis correctly implemented. This ensures that the example script is up-to-date with the latest method names, aligning with the PR's objectives. It's crucial to ensure that all example scripts and documentation reflect these updates for consistency and clarity.CHANGELOG.md (1)
- 5-7: The changelog entry for version 1.4.1 succinctly captures the essence of the updates made to the example scripts, specifically the removal of deprecated method references. This aligns well with the PR objectives and ensures users are informed of the changes in a clear and concise manner.
tests/test_composer_deprecation_warnings.py (1)
- 537-550: The new test method
test_msg_withdraw_delegator_reward_deprecation_warningcorrectly checks for a deprecation warning when using theMsgWithdrawDelegatorRewardmethod. This addition aligns with the PR's objectives to update and improve the test suite.
| ), | ||
| ] | ||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders correctly replaces the deprecated method name. This change aligns with the PR's objective to update example scripts and test files to use current method names. However, there's a minor typo in the sender parameter value ("senders" should be "sender").
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( |
| ), | ||
| ] | ||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for creating derivative orders is correctly updated. The change is consistent with the PR's goal. The same typo in the sender parameter value is present here as well.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( | |
| sender="sender", |
| ), | ||
| ] | ||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for creating binary options orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( |
| ), | ||
| ] | ||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for canceling spot orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( |
| ), | ||
| ] | ||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for canceling derivative orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( | |
| sender="sender", |
| composer = Composer(network="testnet") | ||
|
|
||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for canceling all orders for a spot market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( |
| composer = Composer(network="testnet") | ||
|
|
||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for canceling all orders for a derivative market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( |
| composer = Composer(network="testnet") | ||
|
|
||
| message = composer.MsgBatchUpdateOrders( | ||
| message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders for canceling all orders for a binary options market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| message = composer.msg_batch_update_orders( | |
| message = composer.msg_batch_update_orders( | |
| sender="sender", |
| ), | ||
| ] | ||
| inner_message = composer.MsgBatchUpdateOrders( | ||
| inner_message = composer.msg_batch_update_orders( |
There was a problem hiding this comment.
The method call composer.msg_batch_update_orders within the MsgExec message is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.
- sender="senders",
+ sender="sender",Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| inner_message = composer.msg_batch_update_orders( | |
| inner_message = composer.msg_batch_update_orders( |
| def teste_coin_deprecation_warning(self): | ||
| composer = Composer(network=Network.devnet().string()) | ||
|
|
||
| with warnings.catch_warnings(record=True) as all_warnings: | ||
| composer.Coin( | ||
| amount=1, | ||
| denom="INJ", | ||
| ) | ||
|
|
||
| deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)] | ||
| assert len(deprecation_warnings) == 1 | ||
| assert str(deprecation_warnings[0].message) == "This method is deprecated. Use coin instead" |
There was a problem hiding this comment.
The new test method teste_coin_deprecation_warning correctly checks for a deprecation warning when using the Coin method. However, there's a typo in the method name ("teste" should be "test").
- def teste_coin_deprecation_warning(self):
+ def test_coin_deprecation_warning(self):Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| def teste_coin_deprecation_warning(self): | |
| composer = Composer(network=Network.devnet().string()) | |
| with warnings.catch_warnings(record=True) as all_warnings: | |
| composer.Coin( | |
| amount=1, | |
| denom="INJ", | |
| ) | |
| deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)] | |
| assert len(deprecation_warnings) == 1 | |
| assert str(deprecation_warnings[0].message) == "This method is deprecated. Use coin instead" | |
| def test_coin_deprecation_warning(self): | |
| composer = Composer(network=Network.devnet().string()) | |
| with warnings.catch_warnings(record=True) as all_warnings: | |
| composer.Coin( | |
| amount=1, | |
| denom="INJ", | |
| ) | |
| deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)] | |
| assert len(deprecation_warnings) == 1 | |
| assert str(deprecation_warnings[0].message) == "This method is deprecated. Use coin instead" |
There was a problem hiding this comment.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- tests/test_composer_deprecation_warnings.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- tests/test_composer_deprecation_warnings.py
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation