-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use subparser dest instead of default arg #49
Conversation
WalkthroughThe 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 (
|
PR Review 🔍
|
PR Code Suggestions ✨
|
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: 1
Outside diff range and nitpick comments (1)
src/tyora/__init__.py (1)
Line range hint
1-1
: Optimize the handling of HTTP sessions and cookies.Refactor the session management to ensure efficient use of resources and proper cleanup of sessions. This could involve using context managers for session handling to automatically manage session lifetimes.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/tyora/init.py (2 hunks)
Additional Context Used
Ruff (1)
src/tyora/__init__.py (1)
136-136: Local variable
parser_login
is assigned to but never used
Additional comments not posted (2)
src/tyora/__init__.py (2)
133-133
: Simplified command handling by usingdest
attribute in subparsers.This change consolidates command selection into a single attribute, making the code cleaner and potentially less error-prone.
Line range hint
1-1
: Ensure consistent and secure handling of user credentials.Consider verifying that all user input is properly sanitized and that credentials are handled securely throughout the application. This is crucial for preventing security vulnerabilities.
@@ -130,15 +130,13 @@ def parse_args(args: Optional[list[str]] = None) -> argparse.Namespace: | |||
help="Don't store cookies or cache (they're used for faster access on the future runs)", | |||
action="store_true", | |||
) | |||
subparsers = parser.add_subparsers(required=True) | |||
subparsers = parser.add_subparsers(required=True, dest="cmd") | |||
|
|||
# login subparser | |||
parser_login = subparsers.add_parser("login", help="Login to mooc.fi CSES") |
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.
Local variable parser_login
is assigned but never used.
Consider removing or utilizing the parser_login
variable. If it's intended for future use, perhaps add a comment explaining its purpose.
PR Type
Bug fix
Description
dest
parameter to theadd_subparsers
method to properly handle subparser commands.set_defaults
calls for each subparser.Changes walkthrough 📝
__init__.py
Use `dest` parameter in subparsers instead of `set_defaults`.
src/tyora/init.py
dest="cmd"
toadd_subparsers
call.set_defaults
calls for subparsers.Summary by CodeRabbit