-
Notifications
You must be signed in to change notification settings - Fork 185
Add usages to commands #501
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
Conversation
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| self.contractsDir: str | ||
| self.poolsDir: str | ||
| self.tempDir: str | ||
| self.nodeName: str |
Copilot
AI
Dec 22, 2025
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.
These instance variables are declared with type hints but not initialized. They should be initialized to None with Optional[str] type hints, or initialized with actual values to avoid potential AttributeError exceptions when accessed before assignment.
| self.contractsDir: str | |
| self.poolsDir: str | |
| self.tempDir: str | |
| self.nodeName: str | |
| self.contractsDir: Optional[str] = None | |
| self.poolsDir: Optional[str] = None | |
| self.tempDir: Optional[str] = None | |
| self.nodeName: Optional[str] = None |
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.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def about(local, ton, args): | ||
| from modules import get_mode, get_mode_settings | ||
| if len(args) != 1: | ||
| color_print("{red}Bad args. Usage:{endc} about <mode_name>") | ||
| if not check_usage_one_arg("about", args): | ||
| return |
Copilot
AI
Dec 22, 2025
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.
The function parameter name ton is unused in the function body. Consider removing it or prefixing with underscore if required by interface.
| "ru": "Остановить работающий коллатор на этой ноде. Используйте без аргументов, чтобы остановить все коллаторы", | ||
| "zh_TW": "停止在此節點上運行的協作者。無參數使用以停止所有協作者" | ||
| }, | ||
|
|
Copilot
AI
Dec 22, 2025
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.
Empty line 782 creates unnecessary whitespace. This line should be removed to maintain consistent formatting in the JSON file.
| import os | ||
| import time | ||
|
|
||
| from mypylib.mypylib import color_print |
Copilot
AI
Dec 22, 2025
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.
The unused import os should be removed as it is no longer used after refactoring.
| try: | ||
| poll_addr = args[0] | ||
| amount = float(args[1]) | ||
| except: | ||
| color_print("{red}Bad args. Usage:{endc} deposit_to_pool <pool-addr> <amount>") | ||
| except ValueError: | ||
| color_print("{red}Amount must be a number{endc}") |
Copilot
AI
Dec 22, 2025
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.
The error message "Amount must be a number" is imprecise. It should specify that the amount must be a valid floating-point number, e.g., "Amount must be a valid number".
| return | ||
| adnl_addr, shard_str = args | ||
| if ':' not in shard_str: | ||
| raise Exception(f"Invalid shard: {shard_str}, use format <workchain>:<shard_hex>") |
Copilot
AI
Dec 22, 2025
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.
The error message uses angle brackets <> inconsistently with the usage format pattern elsewhere in the codebase. For consistency with other usage strings, it should match the established convention (which typically uses angle brackets for required parameters in usage strings but not in error messages).
| raise Exception(f"Invalid shard: {shard_str}, use format <workchain>:<shard_hex>") | |
| raise Exception(f"Invalid shard: {shard_str}, use format workchain:shard_hex") |
| if not check_usage_args_min_max_len("calculate_annual_controller_percentage", args, min_len=0, max_len=1): | ||
| return | ||
| if args: | ||
| percent_per_round = float(args[0]) | ||
| except: | ||
| else: | ||
| percent_per_round = self.ton.GetSettings("max_interest_percent") |
Copilot
AI
Dec 22, 2025
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.
The logic should be simplified by directly checking if len(args) > 0 instead of using a separate validation that accepts 0 arguments followed by an if args check. Consider using check_usage_args_min_max_len with min_len=0 consistently or refactoring to a clearer validation pattern.
No description provided.